Package software.amazon.smithy.cli
Interface Arguments
public interface Arguments
Command line arguments list to evaluate.
 
Arguments are parsed on demand. To finalize parsing arguments and force validation of remaining arguments,
 call getPositional(). Note that because arguments are parsed on demand and whole set of arguments isn't
 known before getPositional() is called.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddReceiver(ArgumentReceiver receiver) Adds an argument receiver to the argument list.Gets the positional arguments.<T extends ArgumentReceiver>
 TgetReceiver(Class<T> type) Get a receiver by class.Get the argument receivers registered with the Arguments list.booleanhasNext()Checks if any arguments are remaining.booleanhasReceiver(Class<? extends ArgumentReceiver> receiverClass) Check if this class contains a receiver.static Argumentspeek()Peeks at the next value in the argument list without shifting it.shift()Shifts off the next value in the argument list or returns null.Expects an argument value for a parameter by name.
- 
Method Details- 
of
- 
addReceiverAdds an argument receiver to the argument list.- Parameters:
- receiver- Receiver to add.
 
- 
hasReceiverCheck if this class contains a receiver.- Parameters:
- receiverClass- Class of receiver to detect.
- Returns:
- Returns true if found.
 
- 
getReceiverGet a receiver by class.- Type Parameters:
- T- Type of receiver to get.
- Parameters:
- type- Type of receiver to get.
- Returns:
- Returns the found receiver.
- Throws:
- NullPointerException- if not found.
 
- 
getReceiversIterable<ArgumentReceiver> getReceivers()Get the argument receivers registered with the Arguments list.- Returns:
- Returns the receivers.
 
- 
hasNextboolean hasNext()Checks if any arguments are remaining.- Returns:
- Returns true if there are more arguments.
 
- 
peekString peek()Peeks at the next value in the argument list without shifting it.Note that arguments consumed by a ArgumentReceiverare never peeked.- Returns:
- Returns the next argument or null if no further arguments are present.
 
- 
shiftString shift()Shifts off the next value in the argument list or returns null.- Returns:
- Returns the next value or null.
 
- 
shiftForExpects an argument value for a parameter by name.- Parameters:
- parameter- Name of the parameter to get the value of.
- Returns:
- Returns the value of the parameter.
- Throws:
- CliError- if the parameter is not present.
 
- 
getPositionalGets the positional arguments.Expects that all remaining arguments are positional, and returns them. If an argument is "--", then it's skipped and remaining arguments are considered positional. If any argument is encountered that isn't valid for a registered Receiver, then an error is raised. Otherwise, all remaining arguments are returned in a list. Subscribers for different receivers are called when this method is first called. - Returns:
- Returns remaining arguments.
- Throws:
- CliError- if the next argument starts with "--" but isn't "--".
 
 
-