cli.py 文件源码

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

项目:otree_virtual_machine_manager 作者: tobiasraabe 项目源码 文件源码
def get_command(self, ctx, cmd_name):
        """This function checks whether ``cmd_name`` can be matched to one
        of the registered commands.

        Parameters
        ----------
        cmd_name : str
            Input string from the command line.

        Returns
        -------
        matched_command : click.Command
            Returns matched command

        """
        matched_command = click.Group.get_command(self, ctx, cmd_name)
        if matched_command is not None:
            return matched_command
        matches = [x for x in self.list_commands(ctx)
                   if x.startswith(cmd_name)]
        if not matches:
            return None
        elif len(matches) == 1:
            matched_command = click.Group.get_command(self, ctx, matches[0])
            return matched_command
        ctx.fail('Too many matches: %s' % ', '.join(sorted(matches)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号