diff roundup/scripts/roundup_mailgw.py @ 2186:3f89c8ffe4f1

version info in scripts
author Richard Jones <richard@users.sourceforge.net>
date Mon, 05 Apr 2004 23:43:04 +0000
parents fc52d57c6c3e
children b61640273061
line wrap: on
line diff
--- a/roundup/scripts/roundup_mailgw.py	Mon Apr 05 07:13:10 2004 +0000
+++ b/roundup/scripts/roundup_mailgw.py	Mon Apr 05 23:43:04 2004 +0000
@@ -14,7 +14,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundup_mailgw.py,v 1.11 2004-02-11 23:55:10 richard Exp $
+# $Id: roundup_mailgw.py,v 1.12 2004-04-05 23:43:03 richard Exp $
 
 """Command-line script stub that calls the roundup.mailgw.
 """
@@ -22,6 +22,7 @@
 
 # python version check
 from roundup import version_check
+from roundup import __version__ as roundup_version
 
 import sys, os, re, cStringIO, getopt
 
@@ -31,9 +32,12 @@
 def usage(args, message=None):
     if message is not None:
         print message
-    print _('Usage: %(program)s [[-C class] -S field=value]* <instance '
+    print _('Usage: %(program)s [-v] [[-C class] -S field=value]* <instance '
         'home> [method]')%{'program': args[0]}
     print _('''
+Options:
+ -v: print version and exit
+ -C / -S: see below
 
 The roundup mail gateway may be called in one of three ways:
  . with an instance home as the only argument,
@@ -85,12 +89,17 @@
     # take the argv array and parse it leaving the non-option
     # arguments in the args array.
     try:
-        optionsList, args = getopt.getopt(argv[1:], 'C:S:', ['set=', 'class='])
+        optionsList, args = getopt.getopt(argv[1:], 'vC:S:', ['set=', 'class='])
     except getopt.GetoptError:
         # print help information and exit:
         usage(argv)
         sys.exit(2)
 
+    for (opt, arg) in optionsList:
+        if opt == '-v':
+            print '%s (python %s)'%(roundup_version, sys.version.split()[0])
+            return
+
     # figure the instance home
     if len(args) > 0:
         instance_home = args[0]

Roundup Issue Tracker: http://roundup-tracker.org/