public final class CommandFlags extends CommandElement
| Modifier and Type | Class and Description |
|---|---|
static class |
CommandFlags.Builder |
static class |
CommandFlags.UnknownFlagBehavior
Indicates to the flag parser how it should treat an argument that looks
like a flag that it does not recognise.
|
| Modifier | Constructor and Description |
|---|---|
protected |
CommandFlags(CommandElement childElement,
Map<List<String>,CommandElement> usageFlags,
Map<String,CommandElement> shortFlags,
Map<String,CommandElement> longFlags,
CommandFlags.UnknownFlagBehavior unknownShortFlagBehavior,
CommandFlags.UnknownFlagBehavior unknownLongFlagBehavior,
boolean anchorFlags) |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
complete(CommandSource src,
CommandArgs args,
CommandContext context)
Fetch completions for command arguments.
|
Text |
getUsage(CommandSource src)
Return a usage message for this specific argument.
|
void |
parse(CommandSource source,
CommandArgs args,
CommandContext context)
Attempt to extract a value for this element from the given arguments and
put it in the given context.
|
protected Object |
parseValue(CommandSource source,
CommandArgs args)
Attempt to extract a value for this element from the given arguments.
|
getKey, getUntranslatedKeyprotected CommandFlags(@Nullable CommandElement childElement, Map<List<String>,CommandElement> usageFlags, Map<String,CommandElement> shortFlags, Map<String,CommandElement> longFlags, CommandFlags.UnknownFlagBehavior unknownShortFlagBehavior, CommandFlags.UnknownFlagBehavior unknownLongFlagBehavior, boolean anchorFlags)
public void parse(CommandSource source, CommandArgs args, CommandContext context) throws ArgumentParseException
CommandElementCommandElement.parseValue(CommandSource, CommandArgs) for getting the values.
This method is expected to have no side-effects for the source, meaning
that executing it will not change the state of the CommandSource
in any way.parse in class CommandElementsource - The source to parse forargs - The args to extract fromcontext - The context to supply toArgumentParseException - if unable to extract a valuepublic Text getUsage(CommandSource src)
CommandElementgetUsage in class CommandElementsrc - The source requesting usageprotected Object parseValue(CommandSource source, CommandArgs args) throws ArgumentParseException
CommandElementCommandSource
in any way.parseValue in class CommandElementsource - The source to parse forargs - the argumentsArgumentParseException - if unable to extract a valuepublic List<String> complete(CommandSource src, CommandArgs args, CommandContext context)
CommandElementcomplete in class CommandElementsrc - The source requesting tab completionsargs - The arguments currently providedcontext - The context to store state in