diff --git a/src/main/kotlin/com/xenomachina/argparser/ArgParser.kt b/src/main/kotlin/com/xenomachina/argparser/ArgParser.kt index 7375cca..ee04290 100644 --- a/src/main/kotlin/com/xenomachina/argparser/ArgParser.kt +++ b/src/main/kotlin/com/xenomachina/argparser/ArgParser.kt @@ -615,7 +615,7 @@ class ArgParser( if (helpFormatter != null) { option("-h", "--help", errorName = "HELP", // This should never be used, but we need to say something - help = "show this help message and exit") { + help = helpFormatter.helpMessage) { //now this message is customizable throw ShowHelpException(helpFormatter, delegates.toList()) }.default(Unit).registerRoot() } diff --git a/src/main/kotlin/com/xenomachina/argparser/DefaultHelpFormatter.kt b/src/main/kotlin/com/xenomachina/argparser/DefaultHelpFormatter.kt index ea23ef3..bfcae98 100644 --- a/src/main/kotlin/com/xenomachina/argparser/DefaultHelpFormatter.kt +++ b/src/main/kotlin/com/xenomachina/argparser/DefaultHelpFormatter.kt @@ -65,6 +65,8 @@ class DefaultHelpFormatter( val indent = " " val indentWidth = indent.codePointWidth() + override value helpMessage = "show this help message and exit" + override fun format( programName: String?, columns: Int, diff --git a/src/main/kotlin/com/xenomachina/argparser/HelpFormatter.kt b/src/main/kotlin/com/xenomachina/argparser/HelpFormatter.kt index 5b13b1d..6c0f429 100644 --- a/src/main/kotlin/com/xenomachina/argparser/HelpFormatter.kt +++ b/src/main/kotlin/com/xenomachina/argparser/HelpFormatter.kt @@ -22,6 +22,11 @@ package com.xenomachina.argparser * Formats help for an [ArgParser]. */ interface HelpFormatter { + + /** + * The help message added automatically with the options -h, --help + */ + val helpMessage: String /** * Formats a help message. *