Skip to content

Commit eb88139

Browse files
authored
Improve the launcher command line interface and improve setup command. (#1682)
* More in-depth `--setup`. Add defaults and way to update release channels. * Bundle apache commons CLI. Port CLI parsing. Add simple test for parsing. * Fix argument for `--javaOptions` * Remove `stopAtNonOption`. Remove `--updateAlpha` and `--nolauncher` * Add apache commons CLI to tools and libraries. Make help dialog better. Centralize copyright lines and CLI utilities. * Remove release channel selection from interactive setup. * Add update site to cli setup. Rename reload release channels to launcher metadata. Make update printout nicer. * Add Apache Commons CLI to the readme.
1 parent 92a5cfd commit eb88139

8 files changed

Lines changed: 503 additions & 112 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ Chunky uses the following 3rd party libraries:
203203
- **Apache Maven Artifact by the Apache Software Foundation**
204204
The library is covered by the Apache License, version 2.0.
205205
See the file `licenses/Apache-2.0.txt` for the full license text.
206+
- **Apache Commons CLI by the Apache Software Foundation**
207+
The library is covered by the Apache License, version 2.0.
208+
See the file `licenses/Apache-2.0.txt` for the full license text.
206209
- **FastUtil by Sebastiano Vigna**
207210
FastUtil is covered by Apache License, version 2.0.
208211
See the file `licenses/Apache-2.0.txt` for the full license text.

chunky/src/java/se/llbit/chunky/ui/controller/CreditsController.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import javafx.scene.layout.VBox;
4141
import javafx.scene.text.Font;
4242
import javafx.stage.Stage;
43+
import se.llbit.chunky.HelpCopyright;
4344
import se.llbit.chunky.main.Chunky;
4445
import se.llbit.chunky.plugin.PluginApi;
4546
import se.llbit.chunky.ui.ChunkyFx;
@@ -49,10 +50,11 @@
4950
import se.llbit.util.Pair;
5051

5152
public class CreditsController implements Initializable {
52-
5353
@FXML
5454
private Label version;
5555
@FXML
56+
public Label copyrightLine;
57+
@FXML
5658
private Hyperlink gplv3;
5759
@FXML
5860
private Hyperlink markdown;
@@ -83,6 +85,10 @@ public class CreditsController implements Initializable {
8385
@FXML
8486
private Hyperlink lz4JavaLicense;
8587
@FXML
88+
private Hyperlink apacheCli;
89+
@FXML
90+
private Hyperlink apacheCliLicense;
91+
@FXML
8692
private VBox pluginBox;
8793
@FXML
8894
private ImageView logoImage;
@@ -140,6 +146,8 @@ public void initialize(URL location, ResourceBundle resources) {
140146

141147
version.setText(Chunky.getMainWindowTitle());
142148

149+
copyrightLine.setText(HelpCopyright.COPYRIGHT_LINE);
150+
143151
gplv3.setOnAction(
144152
e -> launchAndReset(gplv3, "https://github.com/chunky-dev/chunky/blob/master/LICENSE")
145153
);
@@ -189,6 +197,11 @@ public void initialize(URL location, ResourceBundle resources) {
189197
lz4JavaLicense.setBorder(Border.EMPTY);
190198
lz4JavaLicense.setOnAction(e -> launchAndReset(lz4JavaLicense, "https://github.com/lz4/lz4-java/blob/master/LICENSE.txt"));
191199

200+
apacheCli.setBorder(Border.EMPTY);
201+
apacheCli.setOnAction(e -> launchAndReset(apacheCli, "https://commons.apache.org/proper/commons-cli/"));
202+
apacheCliLicense.setBorder(Border.EMPTY);
203+
apacheCliLicense.setOnAction(e -> launchAndReset(apacheCliLicense, "http://www.apache.org/licenses/LICENSE-2.0"));
204+
192205
if (!plugins.isEmpty()) {
193206
plugins.forEach((key, item) -> pluginBox.getChildren().addAll(buildBox(item)));
194207
} else {

chunky/src/res/se/llbit/chunky/ui/dialogs/Credits.fxml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<Font name="System Bold" size="14.0"/>
3232
</font>
3333
</Label>
34-
<Label text="Copyright (c) 2010-2024, Jesper Öqvist and Chunky contributors." wrapText="true">
34+
<Label fx:id="copyrightLine" text="Copyright (c) 2010-2024, Jesper Öqvist and Chunky contributors" wrapText="true">
3535
<padding>
3636
<Insets top="10.0"/>
3737
</padding>
@@ -249,6 +249,20 @@
249249
<Insets left="20.0" />
250250
</padding>
251251
</Hyperlink>
252+
253+
<Hyperlink fx:id="apacheCli" text="Apache Commons CLI">
254+
<padding>
255+
<Insets/>
256+
</padding>
257+
</Hyperlink>
258+
<Hyperlink fx:id="apacheCliLicense" text="Apache License 2.0">
259+
<font>
260+
<Font size="10.0"/>
261+
</font>
262+
<padding>
263+
<Insets left="20.0"/>
264+
</padding>
265+
</Hyperlink>
252266
</children>
253267
</VBox>
254268
</children>

launcher/build.gradle

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ configurations {
99
}
1010

1111
dependencies {
12-
bundled 'org.apache.maven:maven-artifact:3.9.9'
12+
bundled 'org.apache.maven:maven-artifact:3.9.9'
13+
bundled 'commons-cli:commons-cli:1.6.0'
1314

14-
implementation project(':lib')
15+
implementation project(':lib')
16+
17+
testImplementation 'com.google.truth:truth:1.1.3'
18+
testImplementation 'junit:junit:4.13.2'
1519
}
1620

1721
java {
@@ -21,13 +25,22 @@ java {
2125
}
2226
}
2327

24-
sourceSets.main {
25-
java.srcDir 'src'
28+
sourceSets {
29+
main {
30+
java {
31+
srcDir 'src'
32+
}
2633
resources {
27-
srcDir 'src'
28-
include '**/*.png'
29-
include '**/*.fxml'
34+
srcDir 'src'
35+
include '**/*.png'
36+
include '**/*.fxml'
3037
}
38+
}
39+
test {
40+
java {
41+
srcDir 'test'
42+
}
43+
}
3144
}
3245

3346
jar {

0 commit comments

Comments
 (0)