monotone-devel
[Top][All Lists]
Advanced

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

[Monotone-devel] --version


From: Tom Tromey
Subject: [Monotone-devel] --version
Date: 22 Aug 2003 17:34:14 -0600

Here's a patch for --version.  Ok?

It isn't perfect.  Maybe we should print "monotone 0.2" instead.
But then GNU packages tend toward the verbose here...

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * monotone.cc (OPT_VERSION): New macro.
        (cpp_main): Handle OPT_VERSION.
        (options): Added `version' entry.
        Include config.h.

Index: monotone.cc
===================================================================
RCS file: /cvsroot/monotone/monotone/monotone.cc,v
retrieving revision 1.4
diff -u -r1.4 monotone.cc
--- monotone.cc 19 Aug 2003 08:47:46 -0000 1.4
+++ monotone.cc 22 Aug 2003 23:40:00 -0000
@@ -3,6 +3,8 @@
 // licensed to the public under the terms of the GNU GPL (>= 2)
 // see the file COPYING for details
 
+#include <config.h>
+
 #include <popt.h>
 #include <cstdio>
 #include <iterator>
@@ -25,6 +27,7 @@
 #define OPT_KEY_NAME 7
 #define OPT_BRANCH_NAME 8
 #define OPT_QUIET 9
+#define OPT_VERSION 10
 
 // main option processing and exception handling code
 
@@ -43,6 +46,7 @@
     {"key", 0, POPT_ARG_STRING, &argstr, OPT_KEY_NAME, "set key for 
signatures", NULL},
     {"db", 0, POPT_ARG_STRING, &argstr, OPT_DB_NAME, "set name of database", 
"monotone.db"},
     {"branch", 0, POPT_ARG_STRING, &argstr, OPT_BRANCH_NAME, "select branch 
cert for operation", NULL},
+    {"version", 0, POPT_ARG_NONE, NULL, OPT_VERSION, "print version number, 
then exit", NULL},
     { NULL, 0, 0, NULL, 0 }
   };
 
@@ -152,6 +156,11 @@
            case OPT_BRANCH_NAME:
              app.branch_name = argstr;
              break;
+
+           case OPT_VERSION:
+             cout << VERSION << endl;
+             clean_shutdown = true;
+             return 0;
 
            case OPT_HELP:
            default:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]