Package software.amazon.smithy.cli
Class StandardOptions
- java.lang.Object
-
- software.amazon.smithy.cli.StandardOptions
-
- All Implemented Interfaces:
ArgumentReceiver
public final class StandardOptions extends java.lang.Object implements ArgumentReceiver
Options available to all commands.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEBUGstatic java.lang.StringFORCE_COLORstatic java.lang.StringHELPstatic java.lang.StringHELP_SHORTstatic java.lang.StringLOGGINGstatic java.lang.StringNO_COLORstatic java.lang.StringQUIETstatic java.lang.StringSTACKTRACE
-
Constructor Summary
Constructors Constructor Description StandardOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnsiColorFormattercolorSetting()booleandebug()booleanhelp()java.util.logging.Levellogging()booleanquiet()voidregisterHelp(HelpPrinter printer)Registers help information to the givenHelpPrinter.booleanstackTrace()booleantestOption(java.lang.String name)Test if the given value-less option is accepted by the receiver.java.util.function.Consumer<java.lang.String>testParameter(java.lang.String name)Test if the given parameter that requires a value is accepted by the receiver.
-
-
-
Field Detail
-
HELP_SHORT
public static final java.lang.String HELP_SHORT
- See Also:
- Constant Field Values
-
HELP
public static final java.lang.String HELP
- See Also:
- Constant Field Values
-
DEBUG
public static final java.lang.String DEBUG
- See Also:
- Constant Field Values
-
QUIET
public static final java.lang.String QUIET
- See Also:
- Constant Field Values
-
STACKTRACE
public static final java.lang.String STACKTRACE
- See Also:
- Constant Field Values
-
NO_COLOR
public static final java.lang.String NO_COLOR
- See Also:
- Constant Field Values
-
FORCE_COLOR
public static final java.lang.String FORCE_COLOR
- See Also:
- Constant Field Values
-
LOGGING
public static final java.lang.String LOGGING
- See Also:
- Constant Field Values
-
-
Method Detail
-
registerHelp
public void registerHelp(HelpPrinter printer)
Description copied from interface:ArgumentReceiverRegisters help information to the givenHelpPrinter.- Specified by:
registerHelpin interfaceArgumentReceiver- Parameters:
printer- Printer to modify.
-
testOption
public boolean testOption(java.lang.String name)
Description copied from interface:ArgumentReceiverTest if the given value-less option is accepted by the receiver.If the option is accepted, the receiver should store a stateful value to indicate the option was received, and the CLI will skip the argument for further processing.
- Specified by:
testOptionin interfaceArgumentReceiver- Parameters:
name- Name of the option to test.- Returns:
- Returns true if accepted.
-
testParameter
public java.util.function.Consumer<java.lang.String> testParameter(java.lang.String name)
Description copied from interface:ArgumentReceiverTest if the given parameter that requires a value is accepted by the receiver.If the parameter is accepted, the receiver returns a Consumer that receives the expected value, and it should store a stateful value to allow the value to be later recalled. The CLI will skip the argument for further processing.
- Specified by:
testParameterin interfaceArgumentReceiver- Parameters:
name- Name of the parameter to test.- Returns:
- Returns a consumer if accepted or null if rejected.
-
help
public boolean help()
-
logging
public java.util.logging.Level logging()
-
quiet
public boolean quiet()
-
debug
public boolean debug()
-
stackTrace
public boolean stackTrace()
-
colorSetting
public AnsiColorFormatter colorSetting()
-
-