public static class CommandLineParser.ParseResults
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.util.List<CommandLineParser.Argument> |
arguments |
java.util.List<CommandLineParser.FlagArg> |
flags |
CommandLineParser |
parser |
java.util.List<CommandLineParser.UnnamedArg> |
unnamed |
private java.util.List<java.lang.String> |
unnamedValues |
Constructor and Description |
---|
ParseResults(CommandLineParser parser,
java.util.List<CommandLineParser.Argument> args) |
Modifier and Type | Method and Description |
---|---|
boolean |
foundAllFlags(java.lang.String... flagNameList) |
CommandLineParser.FlagArg |
getFlag(java.lang.String flagNameOrAlias) |
java.lang.String |
getFlagValue(java.lang.String flagNameOrAlias)
Returns the value of the flag that matches the given name or alias.
|
java.util.List<java.lang.String> |
getUnnamedValues()
Get the list of Unnamed Arguments (i.e.
|
boolean |
hasAnyFlag(java.lang.String... flagNameList)
Returns true if any of the listed flags were found.
|
boolean |
hasFlag(java.lang.String flagNameOrAlias)
Returns true if the specified flag was found.
|
public final java.util.List<CommandLineParser.Argument> arguments
public final java.util.List<CommandLineParser.FlagArg> flags
public final CommandLineParser parser
public final java.util.List<CommandLineParser.UnnamedArg> unnamed
private java.util.List<java.lang.String> unnamedValues
public ParseResults(CommandLineParser parser, java.util.List<CommandLineParser.Argument> args)
public boolean foundAllFlags(java.lang.String... flagNameList)
public CommandLineParser.FlagArg getFlag(java.lang.String flagNameOrAlias)
public java.lang.String getFlagValue(java.lang.String flagNameOrAlias)
If allowRepeats
is true for the flag,
the value returned will be that of the first instance of the flag.
If a parameter value is optional for this flag (i.e. if the
{ CommandLineParser.FlagDef#paramAffinity paramAffinity} of this flag is
{ CommandLineParser.ParamAffinity#OPTIONAL OPTIONAL}), you will not be able to use the
return value to distinguish between a missing flag and a flag that is present but without a value,
because null
is returned in both cases.
However, you can call hasFlag(String)
to determine whether the flag was present or not.
flagNameOrAlias
- The name of the flag to search for.@NotNull public java.util.List<java.lang.String> getUnnamedValues()
public boolean hasAnyFlag(java.lang.String... flagNameList)
flagNameList
- The list of flags to search for.public boolean hasFlag(java.lang.String flagNameOrAlias)
flagNameOrAlias
- The name or one of the aliases the flag.