Package software.amazon.smithy.cli
Interface ArgumentReceiver
-
- All Known Implementing Classes:
BuildOptions,StandardOptions
public interface ArgumentReceiverA command line argument receiver.All non-positional arguments of a
Commandneed a corresponding receiver to accept it through eithertestOption(String)ortestParameter(String). If a non-positional argument is not accepted by any receiver, the CLI will exit with an error.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidregisterHelp(HelpPrinter printer)Registers help information to the givenHelpPrinter.default booleantestOption(java.lang.String name)Test if the given value-less option is accepted by the receiver.default 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.
-
-
-
Method Detail
-
testOption
default boolean testOption(java.lang.String name)
Test 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.
- Parameters:
name- Name of the option to test.- Returns:
- Returns true if accepted.
-
testParameter
default 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.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.
- Parameters:
name- Name of the parameter to test.- Returns:
- Returns a consumer if accepted or null if not accepted.
-
registerHelp
default void registerHelp(HelpPrinter printer)
Registers help information to the givenHelpPrinter.- Parameters:
printer- Printer to modify.
-
-