Skip to content

Commit

Permalink
loader: add boot only option
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Apr 13, 2022
1 parent 4646611 commit a5902bb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/java/org/itxtech/mcl/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ public void start(String[] args) throws Exception {
logger.info("https://github.com/iTXTech/mirai-console-loader");
logger.info(Ansi.ansi().a("This program is licensed under ").fgBrightMagenta().a("GNU AGPL v3"));

options.addOption(Option.builder("z").desc("Skip boot phase").longOpt("dry-run").build());
var bootGroup = new OptionGroup();
bootGroup.addOption(Option.builder("z").desc("Skip boot phase").longOpt("dry-run").build());
bootGroup.addOption(Option.builder().desc("Execute boot phase only").longOpt("boot-only").build());
options.addOptionGroup(bootGroup);

packageManager = new PackageManager(this);
repo = new Repository(this);
Expand All @@ -174,14 +177,17 @@ public void start(String[] args) throws Exception {
parseCli(args, false);
tryCatching(() -> manager.loadAllModules()); //此阶段脚本只能修改loader中变量
parseCli(args, true);
tryCatching(() -> manager.phaseCli()); //此阶段脚本处理命令行参数
tryCatching(() -> manager.phaseLoad()); //此阶段脚本下载包

saveConfig();
boot = true;
if (!cli.hasOption("boot-only")) {
tryCatching(() -> manager.phaseCli()); //此阶段脚本处理命令行参数
tryCatching(() -> manager.phaseLoad()); //此阶段脚本下载包
saveConfig();
}

if (!cli.hasOption("z")) {
tryCatching(() -> manager.phaseBoot()); //此阶段脚本启动mirai,且应该只有一个脚本实现
}

boot = true;
}
}

0 comments on commit a5902bb

Please sign in to comment.