1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-25 07:57:12 -07:00

Merge pull request #470 from ethauvin/master

No longer create directories, etc. when --help or --version are used.
This commit is contained in:
Cedric Beust 2018-01-26 23:59:16 -08:00 committed by GitHub
commit 32bf92e8c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View file

@ -101,5 +101,8 @@ class Args {
@Parameter(names = arrayOf("--update"), description = "Update to the latest version of Kobalt")
var update: Boolean = false
@Parameter(names = arrayOf("--version"), description = "Display the current version of Kobalt")
var version: Boolean = false
}

View file

@ -47,7 +47,6 @@ public class Main {
private int installAndLaunchMain(String[] argv) throws IOException, InterruptedException {
String version = getVersion();
initWrapperFile(version);
List<String> kobaltArgv = new ArrayList<>();
boolean noLaunch = false;
@ -78,6 +77,7 @@ public class Main {
}
int result = 0;
if (! exit) {
initWrapperFile(version);
Path kobaltJarFile = installDistribution();
if (!noLaunch) {
result = launchMain(kobaltJarFile, kobaltArgv);
@ -133,7 +133,7 @@ public class Main {
}
private String getWrapperVersion() {
return wrapperProperties.getProperty(PROPERTY_VERSION);
return wrapperProperties.getProperty(PROPERTY_VERSION, "N/A");
}
private String getWrapperDownloadUrl(String version) {

View file

@ -38,6 +38,14 @@ class Main @Inject constructor(
companion object {
fun mainNoExit(argv: Array<String>): Int {
val (jc, args) = parseArgs(argv)
if (args.usage) {
jc.usage()
return 0
}
if (args.version) {
println("Kobalt ${Kobalt.version}")
return 0
}
Kobalt.init(MainModule(args, KobaltSettings.readSettingsXml()))
val result = launchMain(Kobalt.INJECTOR.getInstance(Main::class.java), jc, args, argv)
return result