menu.py 文件源码

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

项目:lHelper 作者: Julian24816 项目源码 文件源码
def run(cls, command: str, *args: Iterable[str]):
        """
        Runs the registered Command if it exists.
        :raises KeyError: when the command does not exist
        :param command: the registry key of the command to be invoked
        :param args: the arguments to be passed on to the command
        """
        if cls.has_option(command):
            try:
                cls.__registry[command](*args)
            # except Exception as e:
            #     raise e
            except TypeError:
                print(cls.__registry[command].usage_notice())
            except KeyboardInterrupt:
                print("Command aborted.")
            except Exception as e:
                print(e)
                print("Please contact support.")
        else:
            raise UnknownCommand(command)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号