diff --git a/tiramisu_cmdline_parser.py b/tiramisu_cmdline_parser.py index c2dbe17..1730be1 100644 --- a/tiramisu_cmdline_parser.py +++ b/tiramisu_cmdline_parser.py @@ -219,7 +219,10 @@ class TiramisuCmdlineParser(ArgumentParser): 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) try: namespaces = super().parse_args(*args, **kwargs) @@ -236,13 +239,14 @@ class TiramisuCmdlineParser(ArgumentParser): self.error('the following arguments are required: {}'.format(name)) else: self.error('unrecognized arguments: {}'.format(name)) - for key in self.config.value.mandatory(): - if self.fullpath or '.' not in key: - name = key - else: - name = key.rsplit('.', 1)[1] - args = self._gen_argument(name, self.config.option(key).property.get()) - self.error('the following arguments are required: {}'.format(args)) + if valid_mandatory: + for key in self.config.value.mandatory(): + if self.fullpath or '.' not in key: + name = key + else: + name = key.rsplit('.', 1)[1] + args = self._gen_argument(name, self.config.option(key).property.get()) + self.error('the following arguments are required: {}'.format(args)) return namespaces def format_usage(self,