[sysprof] cli: add --version command line option



commit bdf888f556bfce767665d2b0936a2afc8a6513eb
Author: Christian Hergert <christian hergert me>
Date:   Thu Apr 14 03:31:33 2016 -0700

    cli: add --version command line option

 tools/sysprof-cli.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/tools/sysprof-cli.c b/tools/sysprof-cli.c
index 38704e2..6421768 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]