diff options
| author | Andrew Bartlett <abartlet@samba.org> | 2016-02-25 12:42:09 +1300 |
|---|---|---|
| committer | Andrew Bartlett <abartlet@samba.org> | 2016-02-25 04:48:18 +0100 |
| commit | bd51778dc0241c169c0eea7aa52ac21341d7900d (patch) | |
| tree | d536cacd646047d466c2044796917ec9de2a6df4 /python/samba/netcmd | |
| parent | 873df9a8a5508a3a4f51dfe447a5ffcdf18bab09 (diff) | |
| download | samba-bd51778dc0241c169c0eea7aa52ac21341d7900d.tar.gz samba-bd51778dc0241c169c0eea7aa52ac21341d7900d.tar.bz2 samba-bd51778dc0241c169c0eea7aa52ac21341d7900d.zip | |
python: Allow optional multi-value arguements for samba-tool commands
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'python/samba/netcmd')
| -rw-r--r-- | python/samba/netcmd/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/python/samba/netcmd/__init__.py b/python/samba/netcmd/__init__.py index a3edf505165..1debae8c39f 100644 --- a/python/samba/netcmd/__init__.py +++ b/python/samba/netcmd/__init__.py @@ -153,13 +153,14 @@ class Command(object): # Check for a min a max number of allowed arguments, whenever possible # The suffix "?" means zero or one occurence # The suffix "+" means at least one occurence + # The suffix "*" means zero or more occurences min_args = 0 max_args = 0 undetermined_max_args = False for i, arg in enumerate(self.takes_args): - if arg[-1] != "?": + if arg[-1] != "?" and arg[-1] != "*": min_args += 1 - if arg[-1] == "+": + if arg[-1] == "+" or arg[-1] == "*": undetermined_max_args = True else: max_args += 1 |
