Package software.amazon.smithy.cli
Class Parser.Argument
- java.lang.Object
-
- software.amazon.smithy.cli.Parser.Argument
-
- Enclosing class:
- Parser
public static final class Parser.Argument extends java.lang.Object
A command line argument.
-
-
Constructor Summary
Constructors Constructor Description Argument(java.lang.String longName, java.lang.String shortName, Parser.Arity arity, java.lang.String help)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Parser.Arity
getArity()
Gets the arity (number of times an argument value can be provided).java.lang.String
getCanonicalName()
Gets the canonical name, which is the longName if present or the shortName.java.lang.String
getHelp()
Gets the argument help text.java.util.Optional<java.lang.String>
getLongName()
Gets the long name of the argument (e.g., --help).java.util.Optional<java.lang.String>
getShortName()
Gets the short name of the argument (e.g., -h).
-
-
-
Constructor Detail
-
Argument
public Argument(java.lang.String longName, java.lang.String shortName, Parser.Arity arity, java.lang.String help)
- Parameters:
longName
- Long name of the argument (e.g., --help).shortName
- Short name of the argument (e.g., -h).arity
- Arity / number of times a value can be provided.help
- Help text of the argument.
-
-
Method Detail
-
getShortName
public java.util.Optional<java.lang.String> getShortName()
Gets the short name of the argument (e.g., -h).- Returns:
- Returns the optionally present short name.
-
getLongName
public java.util.Optional<java.lang.String> getLongName()
Gets the long name of the argument (e.g., --help).- Returns:
- Returns the optionally present long name.
-
getCanonicalName
public java.lang.String getCanonicalName()
Gets the canonical name, which is the longName if present or the shortName.- Returns:
- Returns the canonicalized argument name.
-
getArity
public Parser.Arity getArity()
Gets the arity (number of times an argument value can be provided).- Returns:
- Returns the argument arity.
-
getHelp
public java.lang.String getHelp()
Gets the argument help text.- Returns:
- Returns the help text.
-
-