diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2021-09-16 17:19:16 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2021-09-16 17:19:16 -0700 |
commit | d581251ca28d052e960ff6d0d6fd234d1ff2baf0 (patch) | |
tree | 76103c7fe326048e5103ca1f7db61f7e6590f027 /src/vmon.c | |
parent | 37f0e9cec9145d134733d3b5211d0c3358f4dee0 (diff) |
vmon: add --version flag
Diffstat (limited to 'src/vmon.c')
-rw-r--r-- | src/vmon.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -175,7 +175,6 @@ static int set_fullscreen(vmon_t *vmon) } -/* print commandline help */ static void print_help(void) { puts( @@ -194,12 +193,18 @@ static void print_help(void) " -z --hertz Sample rate in hertz\n" " -o --output-dir Directory to store saved output to (\".\" if unspecified)\n" " -s --snapshot Save a PNG snapshot upon receiving SIGCHLD\n" + " -v --version Print version\n" "-----------------------------------------------------------------------------" ); } -/* print copyright */ +static void print_version(void) +{ + puts("vmon " VERSION); +} + + static void print_copyright(void) { puts( @@ -290,6 +295,9 @@ static int vmon_handle_argv(vmon_t *vmon, int argc, char * const argv[]) } else if (is_flag(*argv, "-h", "--help")) { print_help(); exit(EXIT_SUCCESS); + } else if (is_flag(*argv, "-v", "--version")) { + print_version(); + exit(EXIT_SUCCESS); } else if ((*argv)[0] == '-') { VWM_ERROR("Unrecognized argument: \"%s\", try --help\n", argv[0]); exit(EXIT_FAILURE); |