Package software.amazon.smithy.cli
Class Arguments
java.lang.Object
software.amazon.smithy.cli.Arguments
Container for parsed command line arguments meant to be queried by Commands.
 
Values parsed for command line arguments are canonicalized to the
 long-form of an argument if available. This means that an argument
 with a short name of "-h" and a long name of "--help" would be made
 available in an Arguments instance as "--help" and not "-h".
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbooleanChecks if a canonicalized argument name was provided.inthashCode()Gets an argument by name or throws if not present.Gets an argument by name or return a default value if not found.Gets the list of positional arguments that came after named arguments.repeatedParameter(String arg) Gets a repeated argument by name or throws if not present.repeatedParameter(String arg, List<String> defaultValues) Gets a repeated argument by name or returns a default list if not found.toString()
- 
Constructor Details- 
Arguments
 
- 
- 
Method Details- 
hasChecks if a canonicalized argument name was provided.This method should be used for checking if a option is set rather than calling parameter(java.lang.String)since that method throws when an argument cannot be found.- Parameters:
- arg- Argument to check for (e.g., "--help").
- Returns:
- Returns true if the argument was set.
 
- 
parameterGets an argument by name or throws if not present.Returns the first value if the argument is repeated. - Parameters:
- arg- Argument to get (e.g., "-h", "--help").
- Returns:
- Returns the value of the matching argument.
- Throws:
- CliError- if the argument cannot be found or if the arg is a option.
 
- 
parameterGets an argument by name or return a default value if not found.- Parameters:
- arg- Argument to get (e.g., "-h", "--help").
- defaultValue- Default value to return if not found.
- Returns:
- Returns the value of the matching argument.
 
- 
repeatedParameterGets a repeated argument by name or throws if not present.- Parameters:
- arg- Argument to retrieve (e.g., "--help").
- Returns:
- Returns a list of values for the argument.
- Throws:
- CliError- if the argument cannot be found or if the arg is a option.
 
- 
repeatedParameterGets a repeated argument by name or returns a default list if not found.- Parameters:
- arg- Argument to retrieve (e.g., "--help").
- defaultValues- Default list of values to return if not found.
- Returns:
- Returns a list of values for the argument.
 
- 
positionalArgumentsGets the list of positional arguments that came after named arguments.- Returns:
- Returns the trailing positional arguments.
 
- 
toString
- 
equals
- 
hashCodepublic int hashCode()
 
-