dispatcher.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:rcli 作者: contains-io 项目源码 文件源码
def _get_parsed_args(command_name, doc, argv):
    # type: (str, str, typing.List[str]) -> typing.Dict[str, typing.Any]
    """Parse the docstring with docopt.

    Args:
        command_name: The name of the subcommand to parse.
        doc: A docopt-parseable string.
        argv: The list of arguments to pass to docopt during parsing.

    Returns:
        The docopt results dictionary. If the subcommand has the same name as
        the primary command, the subcommand value will be added to the
        dictionary.
    """
    _LOGGER.debug('Parsing docstring: """%s""" with arguments %s.', doc, argv)
    args = docopt(doc, argv=argv)
    if command_name == settings.command:
        args[command_name] = True
    return args
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号