From be7c6e78d334ffa9919b970aaecf2ff5f27a0354 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 21 Jul 2020 15:43:06 +0200 Subject: Add --version option --- src/odr-padenc.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp index b919074..da47d5b 100644 --- a/src/odr-padenc.cpp +++ b/src/odr-padenc.cpp @@ -86,6 +86,7 @@ static void usage(const char* name) { " slides is skipped. Use this if you know what you are doing !\n" " It is useful only when -d is used\n" " -v, --verbose Print more information to the console (may be used more than once)\n" + " --version Print version information and quit\n" "\n" "Parameters for uniform PAD encoder only:\n" " -f, --frame-dur=DUR Enable the uniform PAD encoder and set the duration of one frame/AU in milliseconds.\n" @@ -122,6 +123,18 @@ static std::string list_dls_files(std::vector dls_files) { int main(int argc, char *argv[]) { + // Version handling is done very early to ensure nothing else but the version gets printed out + if (argc == 2 and strcmp(argv[1], "--version") == 0) { + fprintf(stdout, "%s\n", +#if defined(GITVERSION) + GITVERSION +#else + PACKAGE_VERSION +#endif + ); + return 0; + } + header(); // get/check options -- cgit v1.2.3