Fix handling of flags with args with maxsplit #2.

Fixes #614.

We only added the long variant of the flag, but not the short one.
This commit is contained in:
Florian Bruhin 2015-04-13 21:12:14 +02:00
parent 501138d5a0
commit 4e18e54803
2 changed files with 2 additions and 2 deletions

View File

@ -321,7 +321,7 @@ class Command:
args.append(short_flag)
self.opt_args[param.name] = long_flag, short_flag
if typ is not bool:
self.flags_with_args.append(param.name)
self.flags_with_args += [short_flag, long_flag]
else:
args.append(name)
self.pos_args.append((param.name, name))

View File

@ -292,7 +292,7 @@ class CommandRunner(QObject):
for i, arg in enumerate(split_args):
arg = arg.strip()
if arg.startswith('-'):
if arg.lstrip('-') in cmd.flags_with_args:
if arg in cmd.flags_with_args:
flag_arg_count += 1
else:
maxsplit = i + cmd.maxsplit + flag_arg_count