X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=main.cpp;h=b7ba5d8994e79c3d5fea053a2d59802ee378d16c;hp=a94f64c67b07b60b45cf2b96b5cb1fc264fbf8c6;hb=d4384c6d5c7cb6dc16979c650cd21aa29f0aedb5;hpb=f7951df4a17a5c7e831dd20d43049137b5761e85 diff --git a/main.cpp b/main.cpp index a94f64c6..b7ba5d89 100644 --- a/main.cpp +++ b/main.cpp @@ -33,6 +33,18 @@ extern "C" { #include "config.h" +void usage() +{ + fprintf(stderr, + "Usage:\n" + " %s — %s\n" + "\n" + "Help Options:\n" + " -V, --version Show release version\n" + " -h, -?, --help Show help option\n" + "\n", PV_BIN_NAME, PV_DESCRIPTION); +} + int main(int argc, char *argv[]) { QApplication a(argc, argv); @@ -46,10 +58,12 @@ int main(int argc, char *argv[]) while (1) { static const struct option long_options[] = { {"version", no_argument, 0, 'V'}, + {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; - const char c = getopt_long(argc, argv, "V", long_options, NULL); + const char c = getopt_long(argc, argv, + "Vh?", long_options, NULL); if (c == -1) break; @@ -58,6 +72,11 @@ int main(int argc, char *argv[]) // Print version info fprintf(stderr, "%s %s\n", PV_TITLE, PV_VERSION_STRING); return 0; + + case 'h': + case '?': + usage(); + return 0; } }