def create_parser(self, prog_name, subcommand): # noqa
"""
Create and return the ``ArgumentParser`` which will be used to
parse the arguments to this command.
"""
parser = CommandParser(
self, prog="%s %s" % (os.path.basename(prog_name), subcommand),
description=self.help or None)
parser.add_argument(
'--traceback', action='store_true',
help=SUPPRESS)
if self.args:
# Keep compatibility and always accept positional arguments,
# like optparse when args is set
parser.add_argument('args', nargs='*')
self.add_arguments(parser)
argcomplete.autocomplete(parser)
return parser
评论列表
文章目录