Mercurial > p > roundup > code
diff roundup-admin @ 386:59ed29a879f6
Fixed option & associated error handling
| author | Jürgen Hermann <jhermann@users.sourceforge.net> |
|---|---|
| date | Mon, 12 Nov 2001 22:51:59 +0000 |
| parents | a1331423eb93 |
| children | d47818b09265 |
line wrap: on
line diff
--- a/roundup-admin Mon Nov 12 22:38:48 2001 +0000 +++ b/roundup-admin Mon Nov 12 22:51:59 2001 +0000 @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup-admin,v 1.44 2001-11-12 22:01:06 richard Exp $ +# $Id: roundup-admin,v 1.45 2001-11-12 22:51:59 jhermann Exp $ import sys if int(sys.version[0]) < 2: @@ -66,8 +66,8 @@ self.help[k[5:]] = getattr(self, k) self.db = None - def usage(message=''): - if message: message = 'Problem: '+message+'\n' + def usage(self, message=''): + if message: message = 'Problem: '+message+'\n\n' print '''%sUsage: roundup-admin [-i instance home] [-u login] [-c] <command> <arguments> Help: @@ -92,7 +92,7 @@ 'Commands may be abbreviated as long as the abbreviation matches only one') commands.append('command, e.g. l == li == lis == list.') print '\n'.join(commands) - print + print def help_all(self): print ''' @@ -851,7 +851,11 @@ self.run_command(args) def main(self): - opts, args = getopt.getopt(sys.argv[1:], 'i:u:hc') + try: + opts, args = getopt.getopt(sys.argv[1:], 'i:u:hc') + except getopt.GetoptError, e: + self.usage(str(e)) + return 1 # handle command-line args self.instance_home = os.environ.get('ROUNDUP_INSTANCE', '') @@ -864,7 +868,7 @@ self.comma_sep = 0 for opt, arg in opts: if opt == '-h': - usage() + self.usage() return 0 if opt == '-i': self.instance_home = arg @@ -888,6 +892,9 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.44 2001/11/12 22:01:06 richard +# Fixed issues with nosy reaction and author copies. +# # Revision 1.43 2001/11/09 22:33:28 richard # More error handling fixes. #
