From 172e0ac6a10957d159b0e356fc2e40677abe11b2 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 7 Oct 2015 21:39:38 -0700 Subject: [PATCH] Display usage when no args. --- src/main/kotlin/com/beust/kobalt/Args.kt | 5 ++++- src/main/kotlin/com/beust/kobalt/Main.kt | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/beust/kobalt/Args.kt b/src/main/kotlin/com/beust/kobalt/Args.kt index 55633bbc..1ba48060 100644 --- a/src/main/kotlin/com/beust/kobalt/Args.kt +++ b/src/main/kotlin/com/beust/kobalt/Args.kt @@ -7,7 +7,7 @@ class Args { var targets: List = arrayListOf() @Parameter(names = arrayOf("-bf", "--buildFile"), description = "The build file") - var buildFile: String? = null + var buildFile: String = "Build.kt" @Parameter(names = arrayOf("--checkVersions"), description = "Check if there are any newer versions of the " + "dependencies") @@ -17,6 +17,9 @@ class Args { "actually running them") var dryRun: Boolean = false + @Parameter(names = arrayOf("--help", "--usage"), description = "Display the help") + var usage: Boolean = false + @Parameter(names = arrayOf("-i", "--init"), description = "Create a new build file based on the current project") var init: Boolean = false diff --git a/src/main/kotlin/com/beust/kobalt/Main.kt b/src/main/kotlin/com/beust/kobalt/Main.kt index 484b33ef..eacf21d2 100644 --- a/src/main/kotlin/com/beust/kobalt/Main.kt +++ b/src/main/kotlin/com/beust/kobalt/Main.kt @@ -109,6 +109,8 @@ private class Main @Inject constructor( // Wrapper().install() ProjectGenerator().run(args) + } else if (args.usage || args.targets.isEmpty()) { + jc.usage() } else { if (! buildFile.exists()) { jc.usage()