Class CLIProcessor
- java.lang.Object
-
- gov.nist.secauto.metaschema.cli.processor.CLIProcessor
-
public class CLIProcessor extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CLIProcessor.CallingContext
-
Field Summary
Fields Modifier and Type Field Description static org.apache.commons.cli.Option
HELP_OPTION
static org.apache.commons.cli.Option
NO_COLOR_OPTION
static List<org.apache.commons.cli.Option>
OPTIONS
static org.apache.commons.cli.Option
QUIET_OPTION
static org.apache.commons.cli.Option
SHOW_STACK_TRACE_OPTION
static org.apache.commons.cli.Option
VERSION_OPTION
-
Constructor Summary
Constructors Constructor Description CLIProcessor(String exec)
CLIProcessor(String exec, List<IVersionInfo> versionInfos)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommandHandler(ICommand handler)
String
getExec()
Gets the command used to execute for use in help text.protected List<ICommand>
getTopLevelCommands()
List<IVersionInfo>
getVersionInfos()
Retrieve the version information for this application.static void
handleQuiet()
static void
main(String... args)
ExitStatus
process(String... args)
Process a set of CLIProcessor arguments.protected void
showVersion()
-
-
-
Field Detail
-
HELP_OPTION
@NonNull public static final org.apache.commons.cli.Option HELP_OPTION
-
NO_COLOR_OPTION
@NonNull public static final org.apache.commons.cli.Option NO_COLOR_OPTION
-
QUIET_OPTION
@NonNull public static final org.apache.commons.cli.Option QUIET_OPTION
-
SHOW_STACK_TRACE_OPTION
@NonNull public static final org.apache.commons.cli.Option SHOW_STACK_TRACE_OPTION
-
VERSION_OPTION
@NonNull public static final org.apache.commons.cli.Option VERSION_OPTION
-
-
Constructor Detail
-
CLIProcessor
public CLIProcessor(@NonNull String exec)
-
CLIProcessor
public CLIProcessor(@NonNull String exec, @NonNull List<IVersionInfo> versionInfos)
-
-
Method Detail
-
getExec
@NonNull public String getExec()
Gets the command used to execute for use in help text.- Returns:
- the command name
-
getVersionInfos
@NonNull public List<IVersionInfo> getVersionInfos()
Retrieve the version information for this application.- Returns:
- the versionInfo
-
addCommandHandler
public void addCommandHandler(@NonNull ICommand handler)
-
process
@NonNull public ExitStatus process(String... args)
Process a set of CLIProcessor arguments.process().getExitCode().getStatusCode()
- Parameters:
args
- the arguments to process- Returns:
- the exit status
-
getTopLevelCommands
protected List<ICommand> getTopLevelCommands()
-
handleQuiet
public static void handleQuiet()
-
showVersion
protected void showVersion()
-
-