def cli(version, force): """A jail manager.""" IOCLogger() skip_check = False os.environ["IOCAGE_SKIP"] = "FALSE" skip_check_cmds = ["--help", "activate", "-v", "--version", "--rc"] try: if force: os.environ["IOCAGE_FORCE"] = "TRUE" else: os.environ["IOCAGE_FORCE"] = "FALSE" if "iocage" in sys.argv[0] and len(sys.argv) == 1: skip_check = True for arg in sys.argv[1:]: if arg in skip_check_cmds: os.environ["IOCAGE_SKIP"] = "TRUE" skip_check = True elif "clean" in arg: skip_check = True os.environ["IOCAGE_FORCE"] = "TRUE" os.environ["IOCAGE_SKIP"] = "TRUE" ioc_check.IOCCheck(silent=True) if not skip_check: ioc_check.IOCCheck() except RuntimeError as err: exit(err)
def cli(version): """A jail manager.""" skip_check = False skip_check_cmds = ["--help", "activate", "-v", "--version"] try: if "iocage" in sys.argv[0] and len(sys.argv) == 1: skip_check = True for arg in sys.argv[1:]: if arg in skip_check_cmds: skip_check = True elif "clean" in arg: skip_check = True ioc_check.IOCCheck(silent=True) if not skip_check: ioc_check.IOCCheck() except RuntimeError as err: exit(err)
def cli(version, force): """A jail manager.""" IOCLogger() skip_check = False os.environ["IOCAGE_SKIP"] = "FALSE" skip_check_cmds = ["--help", "activate", "-v", "--version", "--rc"] try: if force: os.environ["IOCAGE_FORCE"] = "TRUE" else: os.environ["IOCAGE_FORCE"] = "FALSE" if "iocage" in sys.argv[0] and len(sys.argv) == 1: skip_check = True elif "help" in sys.argv and len(sys.argv) == 3: cmd = sys.argv[sys.argv.index("help") - 1] mod = __import__(f"iocage.cli.{cmd}", None, None, ["cli"]) with click.Context(mod.cli) as ctx: print(mod.cli.get_help(ctx)) exit(0) for arg in sys.argv[1:]: if arg in skip_check_cmds: os.environ["IOCAGE_SKIP"] = "TRUE" skip_check = True elif "clean" in arg: skip_check = True os.environ["IOCAGE_FORCE"] = "TRUE" os.environ["IOCAGE_SKIP"] = "TRUE" ioc_check.IOCCheck(silent=True) if not skip_check: ioc_check.IOCCheck() except RuntimeError as err: exit(err)