summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-05-02 19:58:28 -0400
committerJune McEnroe <june@causal.agency>2021-05-02 19:58:28 -0400
commit90fbb368596a36da1b1b1f27a55570926c71c650 (patch)
treeeee92c1db881182cd619d5d11332beef6431a6ef
parentDefault to MANDIR=${PREFIX}/man, support BINDIR (diff)
downloadlitterbox-90fbb368596a36da1b1b1f27a55570926c71c650.tar.gz
litterbox-90fbb368596a36da1b1b1f27a55570926c71c650.zip
Get list of formats to test from unscoop itself
Diffstat (limited to '')
-rw-r--r--Makefile4
-rw-r--r--unscoop.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 9062bef..7c09875 100644
--- a/Makefile
+++ b/Makefile
@@ -20,8 +20,6 @@ OBJS.scoop = scoop.o xdg.o
 OBJS.unscoop = unscoop.o xdg.o
 OBJS = ${OBJS.litterbox} ${OBJS.scoop} ${OBJS.unscoop}
 
-FORMATS = generic catgirl irc textual
-
 dev: tags all test
 
 all: ${BINS}
@@ -40,7 +38,7 @@ ${OBJS}: database.h
 test: .test
 
 .test: unscoop
-	for f in ${FORMATS}; do ./unscoop -! -f $$f || exit 1; done
+	for f in $$(./unscoop -f ?); do ./unscoop -! -f $$f || exit 1; done
 	touch .test
 
 tags: *.[ch]
diff --git a/unscoop.c b/unscoop.c
index 153841c..0ae16d9 100644
--- a/unscoop.c
+++ b/unscoop.c
@@ -221,9 +221,12 @@ static const struct Format {
 };
 
 static const struct Format *formatParse(const char *name) {
+	bool list = !strcmp(name, "?");
 	for (size_t i = 0; i < ARRAY_LEN(Formats); ++i) {
 		if (!strcmp(name, Formats[i].name)) return &Formats[i];
+		if (list) printf("%s\n", Formats[i].name);
 	}
+	if (list) exit(EX_OK);
 	errx(EX_USAGE, "no such format %s", name);
 }
 
/td>June McEnroe 2021-01-12Use hilex for bin HTMLJune McEnroe 2021-01-12Don't output a pre in hilex by defaultJune McEnroe 2021-01-12Move hilex out of hilex directoryJune McEnroe 2021-01-12Consolidate hilex formatters into hilex.cJune McEnroe 2021-01-12Remove hacky tagging from hilexJune McEnroe 2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe 2021-01-12Split fields by tab onlyJune McEnroe 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe 2021-01-09Add c -t flag to print expression typeJune McEnroe 2021-01-05Update taglineJune McEnroe