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 classCLIProcessor.CallingContext
-
Field Summary
Fields Modifier and Type Field Description static org.apache.commons.cli.OptionHELP_OPTIONstatic org.apache.commons.cli.OptionNO_COLOR_OPTIONstatic List<org.apache.commons.cli.Option>OPTIONSstatic org.apache.commons.cli.OptionQUIET_OPTIONstatic org.apache.commons.cli.OptionSHOW_STACK_TRACE_OPTIONstatic org.apache.commons.cli.OptionVERSION_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 voidaddCommandHandler(ICommand handler)StringgetExec()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 voidhandleQuiet()static voidmain(String... args)ExitStatusprocess(String... args)Process a set of CLIProcessor arguments.protected voidshowVersion()
-
-
-
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()
-
-