tools: fix handling optional domain list

It wasn't possible to use QubesArgumentParser(vmname_nargs=...) for
optional domain list - the option forced usage of either --all or
explicit domain list.
This commit is contained in:
Marek Marczykowski-Górecki 2017-12-22 23:03:26 +01:00
parent 9b5546f1b0
commit 4af13d5445
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -361,7 +361,9 @@ class QubesArgumentParser(argparse.ArgumentParser):
default=False, help=argparse.SUPPRESS)
if self._vmname_nargs in [argparse.ZERO_OR_MORE, argparse.ONE_OR_MORE]:
vm_name_group = VmNameGroup(self, self._vmname_nargs)
vm_name_group = VmNameGroup(self,
required=(self._vmname_nargs
not in [argparse.ZERO_OR_MORE, argparse.OPTIONAL]))
self._mutually_exclusive_groups.append(vm_name_group)
elif self._vmname_nargs is not None:
self.add_argument('VMNAME', nargs=self._vmname_nargs,