Revision 320aac17 kamaki/cli/argument.py

b/kamaki/cli/argument.py
442 442
            the parsers arguments specification
443 443
        """
444 444
        self.parser = ArgumentParser(
445
            add_help=False,
446
            formatter_class=RawDescriptionHelpFormatter)
445
            add_help=False, formatter_class=RawDescriptionHelpFormatter)
447 446
        self.syntax = '%s <cmd_group> [<cmd_subbroup> ...] <cmd>' % exe
448 447
        if arguments:
449 448
            self.arguments = arguments
......
513 512
            self.update_parser()
514 513

  
515 514
    def parse(self, new_args=None):
516
        """Do parse user input"""
515
        """Parse user input"""
517 516
        try:
518
            if new_args:
519
                self._parsed, unparsed = self.parser.parse_known_args(new_args)
520
            else:
521
                self._parsed, unparsed = self.parser.parse_known_args()
517
            pkargs = (new_args,) if new_args else ()
518
            self._parsed, unparsed = self.parser.parse_known_args(*pkargs)
522 519
        except SystemExit:
523
            # deal with the fact that argparse error system is STUPID
524 520
            raiseCLIError(CLISyntaxError('Argument Syntax Error'))
525 521
        for name, arg in self.arguments.items():
526 522
            arg.value = getattr(self._parsed, name, arg.default)

Also available in: Unified diff