summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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