|
From: <di...@us...> - 2007-01-26 16:32:15
|
Revision: 300
http://safekeep.svn.sourceforge.net/safekeep/?rev=300&view=rev
Author: dimi
Date: 2007-01-26 08:32:02 -0800 (Fri, 26 Jan 2007)
Log Message:
-----------
Teach usage() to exit if need be, simplify the code a bit.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2007-01-26 16:26:12 UTC (rev 299)
+++ safekeep/trunk/safekeep 2007-01-26 16:32:02 UTC (rev 300)
@@ -740,7 +740,7 @@
# Main routine
######################################################################
-def usage():
+def usage(exitcode=None):
print 'usage: %s [--server] [common options] [server options]' % (sys.argv[0])
print ' %s --client [common options]' % (sys.argv[0])
print ' %s --keys [common options] [keys options] [clientid1 [clientid2] ...]' % (sys.argv[0])
@@ -765,6 +765,7 @@
print '-C, --cfg=FILE|DIR use the given configuration file/directory'
print '-e, --email=EMAIL send results by email (can appear multiple times)'
print '-m, --smtp=SMTP SMTP server to use when sending mails (default: built-in SMTP)'
+ if exitcode is not None: sys.exit(exitcode)
def main():
try:
@@ -774,8 +775,8 @@
'quiet', 'server', 'smtp=', 'status',
'verbose', 'version'])
except getopt.GetoptError:
- usage()
- sys.exit(2)
+ usage(2)
+
mode = 'server'
email = []
smtp = ''
@@ -791,8 +792,7 @@
elif o in ('-e', '--email'):
email.append(a)
elif o in ('-h', '--help'):
- usage()
- sys.exit()
+ usage(0)
elif o in ('-m', '--smtp'):
smtp = a
elif o in ('--server', ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|