From 8060aaa93a03775301fa2396377d2cfd55a4fb2b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 17 Jun 2013 22:25:33 +0200 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/argparser.py | 9 +++++---- 1 file 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): -- cgit v1.2.3-70-g09d2