aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-06-17 22:25:33 +0200
committerMattias Andrée <maandree@operamail.com>2013-06-17 22:25:33 +0200
commit8060aaa93a03775301fa2396377d2cfd55a4fb2b (patch)
tree91410989cd3e94d03ce497b28f341dc9c0784312
parentvariable rename (diff)
downloadargparser-8060aaa93a03775301fa2396377d2cfd55a4fb2b.tar.gz
argparser-8060aaa93a03775301fa2396377d2cfd55a4fb2b.tar.bz2
argparser-8060aaa93a03775301fa2396377d2cfd55a4fb2b.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/argparser.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/argparser.py b/src/argparser.py
index e536f5d..78cc0e0 100644
--- a/src/argparser.py
+++ b/src/argparser.py
@@ -348,16 +348,17 @@ class ArgParser():
@param exit_value:int? The value to exit with on the check does not pass, `None` if not to exit
@return :bool Whether only allowed options was used
'''
+ rc = True
for opt in self.opts:
if (self.opts[opt] is not None) and (opt not in allowed):
msg = self.program + ': option used out of context: ' + opt
if opt != self.optmap[opt][0]:
msg += '(' + self.optmap[opt][0] + ')'
sys.stderr.write(msg + '\n')
- if exit_value is not None:
- sys.exit(exit_value)
- return False
- return True
+ rc = False
+ if (not rc) and (exit_value is not None):
+ sys.exit(exit_value)
+ return rc
def test_files(self, min = 0, max = None, exit_value = None):