public static class CommandFlags.Builder extends Object
Modifier and Type | Method and Description |
---|---|
CommandElement |
buildWith(CommandElement wrapped)
Build a flag command element using the given command element to
handle all non-flag arguments.
|
CommandFlags.Builder |
flag(String... specs)
Allow a flag with any of the provided specifications that has no
value.
|
CommandFlags.Builder |
permissionFlag(String flagPermission,
String... specs)
Allow a flag with any of the provided specifications that has no
value but requires the source to have a specific permission to
specify the command.
|
CommandFlags.Builder |
setAcceptsArbitraryLongFlags(boolean acceptsArbitraryLongFlags)
Deprecated.
in favor of
#setUnknownLongFlagBehavior(UnknownFlagBehavior) . |
CommandFlags.Builder |
setAnchorFlags(boolean anchorFlags)
Whether flags should be anchored to the beginning of the text (so
flags will only be picked up if they are at the beginning of the
input).
|
CommandFlags.Builder |
setUnknownLongFlagBehavior(CommandFlags.UnknownFlagBehavior behavior)
Sets how long flags that are not registered should be handled when
encountered.
|
CommandFlags.Builder |
setUnknownShortFlagBehavior(CommandFlags.UnknownFlagBehavior behavior)
Sets how long flags that are not registered should be handled when
encountered.
|
CommandFlags.Builder |
valueFlag(CommandElement value,
String... specs)
Allow a flag with any of the provided specifications, with the given
command element.
|
public CommandFlags.Builder flag(String... specs)
CommandContext
under
the key equivalent to the first flag in the specification array.
The specifications are handled as so for each element in the
specs
array:
specs
- The flag specificationspublic CommandFlags.Builder permissionFlag(String flagPermission, String... specs)
flagPermission
- The required permissionspecs
- The flag specificationsfor details on the format
public CommandFlags.Builder valueFlag(CommandElement value, String... specs)
value
- The command element used to parse any occurrencesspecs
- The flag specificationsfor information on how the flag specifications
are parsed
@Deprecated public CommandFlags.Builder setAcceptsArbitraryLongFlags(boolean acceptsArbitraryLongFlags)
#setUnknownLongFlagBehavior(UnknownFlagBehavior)
.acceptsArbitraryLongFlags
- Whether any long flag is acceptedpublic CommandFlags.Builder setUnknownLongFlagBehavior(CommandFlags.UnknownFlagBehavior behavior)
behavior
- The behavior to usepublic CommandFlags.Builder setUnknownShortFlagBehavior(CommandFlags.UnknownFlagBehavior behavior)
If a command that supports flags accepts negative numbers (or
arguments that may begin with a dash), setting this to
CommandFlags.UnknownFlagBehavior.IGNORE
will cause these elements to
be ignored by the flag parser and will be parsed by the command's
non-flag elements instead.
behavior
- The behavior to usepublic CommandFlags.Builder setAnchorFlags(boolean anchorFlags)
anchorFlags
- Whether flags are anchoredpublic CommandElement buildWith(CommandElement wrapped)
If you wish to add multiple elements here, wrap them in
GenericArguments.seq(CommandElement...)
wrapped
- The wrapped command element