add valid_mandatory to parse_args
This commit is contained in:
parent
02f7e7eabf
commit
687fd8e260
@ -219,7 +219,10 @@ class TiramisuCmdlineParser(ArgumentParser):
|
|||||||
group.add_argument(*args, **kwargs)
|
group.add_argument(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def parse_args(self, *args, **kwargs):
|
def parse_args(self,
|
||||||
|
*args,
|
||||||
|
valid_mandatory=True,
|
||||||
|
**kwargs):
|
||||||
kwargs['namespace'] = TiramisuNamespace(self.config)
|
kwargs['namespace'] = TiramisuNamespace(self.config)
|
||||||
try:
|
try:
|
||||||
namespaces = super().parse_args(*args, **kwargs)
|
namespaces = super().parse_args(*args, **kwargs)
|
||||||
@ -236,6 +239,7 @@ class TiramisuCmdlineParser(ArgumentParser):
|
|||||||
self.error('the following arguments are required: {}'.format(name))
|
self.error('the following arguments are required: {}'.format(name))
|
||||||
else:
|
else:
|
||||||
self.error('unrecognized arguments: {}'.format(name))
|
self.error('unrecognized arguments: {}'.format(name))
|
||||||
|
if valid_mandatory:
|
||||||
for key in self.config.value.mandatory():
|
for key in self.config.value.mandatory():
|
||||||
if self.fullpath or '.' not in key:
|
if self.fullpath or '.' not in key:
|
||||||
name = key
|
name = key
|
||||||
|
Loading…
Reference in New Issue
Block a user