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:
parent
501138d5a0
commit
4e18e54803
@ -321,7 +321,7 @@ class Command:
|
|||||||
args.append(short_flag)
|
args.append(short_flag)
|
||||||
self.opt_args[param.name] = long_flag, short_flag
|
self.opt_args[param.name] = long_flag, short_flag
|
||||||
if typ is not bool:
|
if typ is not bool:
|
||||||
self.flags_with_args.append(param.name)
|
self.flags_with_args += [short_flag, long_flag]
|
||||||
else:
|
else:
|
||||||
args.append(name)
|
args.append(name)
|
||||||
self.pos_args.append((param.name, name))
|
self.pos_args.append((param.name, name))
|
||||||
|
@ -292,7 +292,7 @@ class CommandRunner(QObject):
|
|||||||
for i, arg in enumerate(split_args):
|
for i, arg in enumerate(split_args):
|
||||||
arg = arg.strip()
|
arg = arg.strip()
|
||||||
if arg.startswith('-'):
|
if arg.startswith('-'):
|
||||||
if arg.lstrip('-') in cmd.flags_with_args:
|
if arg in cmd.flags_with_args:
|
||||||
flag_arg_count += 1
|
flag_arg_count += 1
|
||||||
else:
|
else:
|
||||||
maxsplit = i + cmd.maxsplit + flag_arg_count
|
maxsplit = i + cmd.maxsplit + flag_arg_count
|
||||||
|
Loading…
Reference in New Issue
Block a user