Package software.amazon.smithy.cli
Class Parser
java.lang.Object
software.amazon.smithy.cli.Parser
Defines the CLI argument parser of a
Command
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
A command line argument.static enum
Defines the arity of an argument.static final class
Builds anParser
. -
Method Summary
Modifier and TypeMethodDescriptionstatic Parser.Builder
builder()
getArgs()
Parses command line arguments in anArguments
object.Parses command line arguments in anArguments
object.
-
Method Details
-
builder
-
getPositionalName
-
getPositionalHelp
-
getArgs
-
parse
Parses command line arguments in anArguments
object.All arguments after the first argument that does not start with "-" or after "--" are treated as positional options. Arguments that come before this must be present in the argument spec returned by the command. Any encountered unknown argument will throw an exception. Arguments that expect a value and do not find one will throw an exception.
- Parameters:
args
- Arguments to parse.- Returns:
- Returns the parsed arguments.
- Throws:
CliError
- if the arguments are invalid.
-
parse
Parses command line arguments in anArguments
object.- Parameters:
args
- Arguments to parse.offset
- Number of arguments to skip before parsing.- Returns:
- Returns the parsed arguments.
- Throws:
CliError
- if the arguments are invalid.- See Also:
-