diff --git a/README.md b/README.md index 91ae8bf..3dc3626 100644 --- a/README.md +++ b/README.md @@ -6,25 +6,25 @@ Some very basic instructions: ```sh - { clone with git or download the ZIP } + # clone with git or download the ZIP git clone https://github.com/ethauvin/mobibot.git cd mobibot - { build with gradle } + # build with gradle ./gradlew cd deploy - { configure the properties } + # configure the properties vi *.properties *.xml - { help } + # help java -jar mobibot.jar -h - { twitter oauth token request } + # twitter oauth token request java -cp mobibot.jar net.thauvin.erik.mobibot.TwitterOAuth - { launch } + # launch /usr/bin/nohup java -jar mobibot.jar & ``` diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Constants.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Constants.kt index f96e30b..6b82d55 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Constants.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Constants.kt @@ -55,6 +55,11 @@ object Constants { */ const val DEFAULT_SERVER = "irc.libera.chat" + /** + * CLI command for usage. + */ + const val CLI_CMD = "java -jar ${ReleaseInfo.PROJECT}.jar [OPTIONS]" + /** * Help command line argument. */ diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt index 01d2548..10df273 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt @@ -34,6 +34,7 @@ package net.thauvin.erik.mobibot import net.thauvin.erik.mobibot.Utils.appendIfMissing import net.thauvin.erik.mobibot.Utils.bot +import net.thauvin.erik.mobibot.Utils.capitalise import net.thauvin.erik.mobibot.Utils.getIntProperty import net.thauvin.erik.mobibot.Utils.helpCmdSyntax import net.thauvin.erik.mobibot.Utils.helpFormat @@ -274,18 +275,20 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro try { commandLine = parser.parse(options, args) } catch (e: ParseException) { - System.err.println("CLI Parsing failed. Reason: ${e.message}") + System.err.println(e.message) + HelpFormatter().printHelp(Constants.CLI_CMD, options) exitProcess(1) } when { commandLine.hasOption(Constants.HELP_ARG[0]) -> { // Output the usage - HelpFormatter().printHelp(Mobibot::class.java.name, options) + HelpFormatter().printHelp(Constants.CLI_CMD, options) } commandLine.hasOption(Constants.VERSION_ARG[0]) -> { // Output the version - println("${ReleaseInfo.PROJECT} ${ReleaseInfo.VERSION} (${ReleaseInfo.BUILDDATE.toIsoLocalDate()})") + println("${ReleaseInfo.PROJECT.capitalise()} ${ReleaseInfo.VERSION}" + + " (${ReleaseInfo.BUILDDATE.toIsoLocalDate()})") println(ReleaseInfo.WEBSITE) }