Class CLIProcessor.CallingContext
java.lang.Object
gov.nist.secauto.metaschema.cli.processor.CLIProcessor.CallingContext
- Enclosing class:
- CLIProcessor
Records information about the command line options and called command
hierarchy.
-
Method Summary
Modifier and TypeMethodDescriptionGet the command line processor instance that generated this calling context.Get the command that was triggered by the CLI arguments.handleError
(ExitStatus exitStatus, org.apache.commons.cli.CommandLine cmdLine, boolean showHelp) Handle an error that occurred while executing the command.handleInvalidCommand
(String message) Generate the help message and exit status for an invalid command using the provided message.Process the command identified by the CLI arguments.void
showHelp()
Output the help text to the console.
-
Method Details
-
getCLIProcessor
Get the command line processor instance that generated this calling context.- Returns:
- the instance
-
getTargetCommand
Get the command that was triggered by the CLI arguments.- Returns:
- the command or
null
if no command was triggered
-
processCommand
Process the command identified by the CLI arguments.- Returns:
- the result of processing the command
-
handleError
@NonNull public ExitStatus handleError(@NonNull ExitStatus exitStatus, @NonNull org.apache.commons.cli.CommandLine cmdLine, boolean showHelp) Handle an error that occurred while executing the command.- Parameters:
exitStatus
- the execution resultcmdLine
- the command line informationshowHelp
- iftrue
show the help information- Returns:
- the resulting exit status
-
handleInvalidCommand
Generate the help message and exit status for an invalid command using the provided message.- Parameters:
message
- the error message- Returns:
- the resulting exit status
-
showHelp
Output the help text to the console.
-