mirror of
https://github.com/samba-team/samba.git
synced 2025-07-14 12:59:07 +03:00
s4/net: Allow options before arguments for Python commands.
This commit is contained in:
committed by
Jelmer Vernooij
parent
433f58f5a7
commit
e2c4d8281d
@ -75,12 +75,13 @@ class Command(object):
|
||||
parser, optiongroups = self._create_parser()
|
||||
opts, args = parser.parse_args(list(argv))
|
||||
# Filter out options from option groups
|
||||
args = args[1:]
|
||||
kwargs = dict(opts.__dict__)
|
||||
for option_group in parser.option_groups:
|
||||
for option in option_group.option_list:
|
||||
del kwargs[option.dest]
|
||||
kwargs.update(optiongroups)
|
||||
if len(args) < len(self.takes_args):
|
||||
if len(args) != len(self.takes_args):
|
||||
self.usage(args)
|
||||
return -1
|
||||
try:
|
||||
|
Reference in New Issue
Block a user