From bdf888f556bfce767665d2b0936a2afc8a6513eb Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 14 Apr 2016 03:31:33 -0700 Subject: [PATCH] cli: add --version command line option --- tools/sysprof-cli.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/sysprof-cli.c b/tools/sysprof-cli.c index 38704e2d..64217683 100644 --- a/tools/sysprof-cli.c +++ b/tools/sysprof-cli.c @@ -88,11 +88,13 @@ main (gint argc, GError *error = NULL; GSource *gsource; gchar *command = NULL; + gboolean version = FALSE; int pid = -1; int fd; GOptionEntry entries[] = { { "pid", 'p', 0, G_OPTION_ARG_INT, &pid, N_("Make sysprof specific to a task"), N_("PID") }, { "command", 'c', 0, G_OPTION_ARG_STRING, &command, N_("Run a command and profile the process"), N_("COMMAND") }, + { "version", 0, 0, G_OPTION_ARG_NONE, &version, N_("Print the sysprof-cli version and exit") }, { NULL } }; @@ -107,6 +109,12 @@ main (gint argc, return EXIT_FAILURE; } + if (version) + { + g_print ("Sysprof "PACKAGE_VERSION"\n"); + return EXIT_SUCCESS; + } + if (argc > 2) { gint i;