bitkeeper revision 1.1108.1.10 (40ffca0cD1Dy4C5W0JRW9WjeIXOWPA)

Catch getopt errors.
This commit is contained in:
mjw@wray-m-3.hpl.hp.com committed 2004-07-22 14:07:08 +00:00
1 parent 1cf700faee
commit 20cd16c058
1 file changed
+6 -3
+6 -3
View File
@@ -1,7 +1,7 @@
# Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
"""Object-oriented command-line option support.
"""
from getopt import getopt
from getopt import getopt, GetoptError
import os
import os.path
import sys
@@ -273,7 +273,10 @@ class Opts:
return remaining arguments
"""
self.argv = argv
(vals, args) = getopt(argv[1:], self.short_opts(), self.long_opts())
try:
(vals, args) = getopt(argv[1:], self.short_opts(), self.long_opts())
except GetoptError, err:
self.err(str(err))
self.args = args
for (k, v) in vals:
for opt in self.options:
@@ -331,7 +334,7 @@ class Opts:
else:
p = self.vals.defaults
if os.path.exists(p):
print 'Using config file %s\n' % (p)
self.info('Using config file %s' % p)
self.load(p, help)
break
else:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.