Add support for rendering help info for input and output

This commit is contained in:
Paul Schaub 2024-09-18 15:50:17 +02:00
parent a98afb1755
commit 62d9cd1991
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
4 changed files with 115 additions and 5 deletions

View file

@ -83,16 +83,20 @@ class SopCLI {
return CommandLine(SopCLI::class.java)
.apply {
// explicitly set help command resource bundle
subcommands["help"]?.setResourceBundle(ResourceBundle.getBundle("msg_help"))
// Hide generate-completion command
subcommands["generate-completion"]?.commandSpec?.usageMessage()?.hidden(true)
// render Input/Output sections in help command
subcommands.values.filter { (it.getCommand() as Any) is AbstractSopCmd } // Only for AbstractSopCmd objects
.forEach { (it.getCommand() as AbstractSopCmd).installIORenderer(it) }
// overwrite executable name
commandName = EXECUTABLE_NAME
// setup exception handling
executionExceptionHandler = SOPExecutionExceptionHandler()
exitCodeExceptionMapper = SOPExceptionExitCodeMapper()
isCaseInsensitiveEnumValuesAllowed = true
}
.execute(*args)
}.execute(*args)
}
}