summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2021-09-16 17:19:16 -0700
committerVito Caputo <vcaputo@pengaru.com>2021-09-16 17:19:16 -0700
commitd581251ca28d052e960ff6d0d6fd234d1ff2baf0 (patch)
tree76103c7fe326048e5103ca1f7db61f7e6590f027 /src
parent37f0e9cec9145d134733d3b5211d0c3358f4dee0 (diff)
vmon: add --version flag
Diffstat (limited to 'src')
-rw-r--r--src/vmon.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/vmon.c b/src/vmon.c
index 30ed630..c8e21f9 100644
--- a/src/vmon.c
+++ b/src/vmon.c
@@ -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);
© All Rights Reserved