Commit 3dbe4e5e authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

ENH: --variable/--exclude/--subject args now accept comma-separated mixtures

of IDs and ranges
parent fdf9e6ba
......@@ -638,26 +638,24 @@ def parseArgs(argv=None, namespace=None):
parsed = [int(t.strip()) for t in parsed]
else:
# Or they may be an ID or matlab-style
# start[:step[:stop]] range, both handled
# by the parseMatlabRange function.
try: parsed = util.parseMatlabRange(thing)
except ValueError: parsed = None
# Or they may be a comma-separated
# list of IDs
if parsed is None:
try:
parsed = [int(v) for v in thing.split(',')]
# Or they may be one or more comma-separated
# IDs or matlab start:step[:stop] ranges,
# both handled by the parseMatlabRange function.
try:
parsed = []
for tkn in thing.split(','):
parsed.extend(util.parseMatlabRange(tkn))
except ValueError:
parsed = None
# --subject may also be an expression,
# so if error is False, and the range/
# list parses fail, we pass the argument
# through. Otherwise we propagate the
# error.
except ValueError:
if error:
raise
if error:
raise
if parsed is None:
failed.append(thing)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment