Class CLIProcessor.CallingContext

java.lang.Object
gov.nist.secauto.metaschema.cli.processor.CLIProcessor.CallingContext
Enclosing class:
CLIProcessor

public final class CLIProcessor.CallingContext extends Object
Records information about the command line options and called command hierarchy.
  • Method Details

    • getCLIProcessor

      @NonNull public CLIProcessor getCLIProcessor()
      Get the command line processor instance that generated this calling context.
      Returns:
      the instance
    • getTargetCommand

      @Nullable public ICommand getTargetCommand()
      Get the command that was triggered by the CLI arguments.
      Returns:
      the command or null if no command was triggered
    • processCommand

      @NonNull public ExitStatus 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 result
      cmdLine - the command line information
      showHelp - if true show the help information
      Returns:
      the resulting exit status
    • handleInvalidCommand

      @NonNull public ExitStatus handleInvalidCommand(@NonNull String message)
      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

      public void showHelp()
      Output the help text to the console.