diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2023-01-01 17:59:55 +0000 |
---|---|---|
committer | Michael Drake <mdrake.unique@gmail.com> | 2023-01-01 18:02:44 +0000 |
commit | d4e69fcebd776233c42ef044230ce3b5b83e61de (patch) | |
tree | 5ad94c96c76cfbc74ec46a88ca87a150e659ce52 | |
parent | 68350cd5c6d73ad210e1ae9d1dd102f4295639c1 (diff) | |
download | libnsgif-d4e69fcebd776233c42ef044230ce3b5b83e61de.tar.gz libnsgif-d4e69fcebd776233c42ef044230ce3b5b83e61de.tar.bz2 |
test: Add --help option to nsgif utility
-rw-r--r-- | test/nsgif.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/test/nsgif.c b/test/nsgif.c index 53c6a68..f873bab 100644 --- a/test/nsgif.c +++ b/test/nsgif.c @@ -29,15 +29,17 @@ static struct nsgif_options { uint64_t loops; bool palette; bool info; + bool help; } nsgif_options; static const struct cli_table_entry cli_entries[] = { { - .s = 'm', - .l = "ppm", - .t = CLI_STRING, - .v.s = &nsgif_options.ppm, - .d = "Convert frames to PPM image at given path." + .s = 'h', + .l = "help", + .t = CLI_BOOL, + .no_pos = true, + .v.b = &nsgif_options.help, + .d = "Print this text.", }, { .s = 'i', @@ -55,6 +57,13 @@ static const struct cli_table_entry cli_entries[] = { "The default is 1." }, { + .s = 'm', + .l = "ppm", + .t = CLI_STRING, + .v.s = &nsgif_options.ppm, + .d = "Convert frames to PPM image at given path." + }, + { .s = 'p', .l = "palette", .t = CLI_BOOL, @@ -358,6 +367,11 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } + if (nsgif_options.help) { + cli_help(&cli, argv[0]); + return EXIT_SUCCESS; + } + if (nsgif_options.ppm != NULL) { ppm = fopen(nsgif_options.ppm, "w+"); if (ppm == NULL) { |