Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to download/update libraries without starting mirai #8

Merged
merged 5 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified mcl
100644 → 100755
Empty file.
6 changes: 6 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

`.\mcl --enable-script updater`

* 更新运行库但不启动

`.\mcl --dry-run`

* 查看帮助

```
Expand All @@ -46,6 +50,8 @@ usage: mcl
-u,--disable-update Disable auto update
-v,--set-maven-repo <Address> Set Maven Repo address
-w,--version <Version> Set version of package
-z,--dry-run Only download libraries without
running them
```

## 开源许可证
Expand Down
8 changes: 7 additions & 1 deletion scripts/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ group.addOption(Option.builder("f").desc("Set Mirai Console boot entry")
.longOpt("set-boot-entry").hasArg().argName("EntryClass").build());
group.addOption(Option.builder("g").desc("Set Mirai Console boot arguments")
.longOpt("set-boot-args").optionalArg(true).hasArg().argName("Arguments").build());
group.addOption(Option.builder("z").desc("Only download libraries without running them")
.longOpt("dry-run").build());
loader.options.addOptionGroup(group);

phase.cli = () => {
Expand Down Expand Up @@ -62,6 +64,10 @@ function getBootArgs() {
}

phase.boot = () => {
if (loader.cli.hasOption("z")) {
return;
}

let files = [];
let pkgs = loader.config.packages;
for (let i in pkgs) {
Expand All @@ -70,6 +76,6 @@ phase.boot = () => {
files.push(new File(new File(pkg.type), pkg.getName() + "-" + pkg.version + ".jar"));
}
}

Utility.bootMirai(files, getBootEntry(), getBootArgs());
}