summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2021-10-13 21:14:56 +0200
committerHans Ulrich Niedermann <hun@n-dimensional.de>2021-10-13 22:24:22 +0200
commit2f88b7788d100b58a5f817d0678897d10a0fd979 (patch)
tree896de4e439224a5414f472cb3579cdb47ccb5828 /tests
parent94d9912e1ee0451a6001347885b27ac2df659e76 (diff)
downloadlibgphoto2-2f88b7788d100b58a5f817d0678897d10a0fd979.tar.gz
test-camera-list: Add --help output
Diffstat (limited to 'tests')
-rw-r--r--tests/test-camera-list.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test-camera-list.c b/tests/test-camera-list.c
index 93835a850..dc24a93c8 100644
--- a/tests/test-camera-list.c
+++ b/tests/test-camera-list.c
@@ -130,6 +130,23 @@ typedef enum {
static OutputFormat format = FMT_HEADED_TEXT;
+static
+const char usage[] = ""
+ "Usage: %s [--debug] --format=FORMAT\n"
+ "\n"
+ "Prints list of cameras supported by libgphoto2 in a certain output format.\n"
+ "\n"
+ "List of FORMAT values\n"
+ " text Text table with headers (the default)\n"
+ " flattext Text table without headers\n"
+ " csv Comma Separated Values (CSV) without headers\n"
+ " xml Custom demo XML schema\n"
+ " count Just print the number of cameras in the list\n"
+ " camlibs Text table of just the camlibs\n"
+ " Pipe this through `| sort | uniq` to get a useful output.\n"
+ ;
+
+
/* #define DEBUG_OUTPUT */
@@ -160,6 +177,10 @@ parse_command_line (const int argc, char *argv[])
format = FMT_COUNT;
} else if (strcmp(argv[i], "--format=camlibs") == 0) {
format = FMT_FLAT_CAMLIBS;
+ } else if (strcmp(argv[i], "--help") == 0) {
+ const char * const bn = path_basename(argv[0]);
+ printf(usage, bn);
+ exit(0);
} else {
const char * const bn = path_basename(argv[0]);
printf("Unknown command line parameter %d: \"%s\"\n",