extracttests.py: cleaned up the code for parsing of command line

This commit is contained in:
Daniel Marjamäki 2011-11-27 15:24:13 +01:00
parent 681e4ba314
commit ac06f34627
1 changed files with 6 additions and 8 deletions

View File

@ -124,7 +124,7 @@ def writeHtmlFile(nodes, functionName, filename, errorsOnly):
fout.close()
if len(sys.argv) == 1 or '--help' in sys.argv:
if len(sys.argv) <= 1 or '--help' in sys.argv:
print 'Extract test cases from test file'
print 'Syntax: extracttests.py [--html=folder] [--xml] path/testfile.cpp'
sys.exit(0)
@ -133,16 +133,14 @@ if len(sys.argv) == 1 or '--help' in sys.argv:
xml = False
filename = None
htmldir = None
i = 1
while i < len(sys.argv):
if sys.argv[i] == '--xml':
for arg in sys.argv[1:]:
if arg == '--xml':
xml = True
elif sys.argv[i].startswith('--html='):
arg = sys.argv[i]
elif arg.startswith('--html='):
htmldir = arg[7:]
else:
filename = sys.argv[i]
i = i + 1
filename = arg
# extract test cases
if filename != None: