Package software.amazon.smithy.cli
Interface ArgumentReceiver
- All Known Implementing Classes:
BuildOptions,StandardOptions
public interface ArgumentReceiver
A command line argument receiver.
All non-positional arguments of a Command need a
corresponding receiver to accept it through either
testOption(String) or testParameter(String).
If a non-positional argument is not accepted by any receiver,
the CLI will exit with an error.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidregisterHelp(HelpPrinter printer) Registers help information to the givenHelpPrinter.default booleantestOption(String name) Test if the given value-less option is accepted by the receiver.testParameter(String name) Test if the given parameter that requires a value is accepted by the receiver.
-
Method Details
-
testOption
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
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
Registers help information to the givenHelpPrinter.- Parameters:
printer- Printer to modify.
-