main.py 文件源码

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

项目:iocage 作者: iocage 项目源码 文件源码
def get_command(self, ctx, name):
        try:
            mod = __import__(f"iocage.cli.{name}", None, None, ["cli"])
            mod_name = mod.__name__.replace("iocage.cli.", "")

            try:
                if mod.__rootcmd__ and "--help" not in sys.argv[1:]:
                    if len(sys.argv) != 1:
                        if os.geteuid() != 0:
                            sys.exit("You need to have root privileges to"
                                     f" run {mod_name}")
            except AttributeError:
                # It's not a root required command.
                pass

            return mod.cli
        except (ImportError, AttributeError):
            return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号