Package org.jboss.as.cli
Interface CommandArgument
-
- All Known Subinterfaces:
RequestParameterArgument
- All Known Implementing Classes:
ArgumentWithListValue,ArgumentWithoutValue,ArgumentWithValue,ConditionArgument,FileSystemPathArgument,RequestParamArgWithoutValue,RequestParamArgWithValue,RequestParamPropertiesArg,RequiredRequestParamArg
public interface CommandArgument- Author:
- Alexey Loubyansky
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancanAppearNext(CommandContext ctx)Checks whether the argument can appear on the command given the already present arguments.default StringgetDecoratedName()The name can contain some tags to advertise status (e.g.: required).StringgetFullName()The default name of the argument.intgetIndex()If the argument doesn't have a name its value can be found by index.StringgetShortName()Short name of the argument if exists.StringgetValue(ParsedCommandLine args)Returns the value of the argument specified on the command line.StringgetValue(ParsedCommandLine args, boolean required)Returns the value of the argument specified on the command line.CommandLineCompletergetValueCompleter()Returns the tab-completer for the value.booleanisPresent(ParsedCommandLine args)Checks whether the argument is present on the command line.booleanisValueComplete(ParsedCommandLine args)Checks whether the value is specified and complete.booleanisValueRequired()Checks whether the argument accepts value.
-
-
-
Method Detail
-
getFullName
String getFullName()
The default name of the argument. An argument can have more than one name, e.g. --force and -f. Full name can't be null.- Returns:
- the default name of the argument.
-
getDecoratedName
default String getDecoratedName()
The name can contain some tags to advertise status (e.g.: required).- Returns:
- The default name of the argument with optional tags.
-
getShortName
String getShortName()
Short name of the argument if exists.- Returns:
- short name of the argument or null if the short name doesn't exist.
-
getIndex
int getIndex()
If the argument doesn't have a name its value can be found by index. Indexes start with 0. A command could have both a name and an index. In that case, the name is optional. If the command doesn't have a fixed index, the method will return -1.- Returns:
- the index of the argument.
-
isPresent
boolean isPresent(ParsedCommandLine args) throws CommandFormatException
Checks whether the argument is present on the command line.- Parameters:
args- parsed arguments- Returns:
- true if the argument is present, false - otherwise.
- Throws:
CommandFormatException
-
canAppearNext
boolean canAppearNext(CommandContext ctx) throws CommandFormatException
Checks whether the argument can appear on the command given the already present arguments. (Used for tab-completion. Although, often isValueComplete(ParsedOperationRequest req) would be more appropriate.)- Parameters:
ctx-- Returns:
- true if the argument can appear on the command line next, false - otherwise.
- Throws:
CommandFormatException
-
getValue
String getValue(ParsedCommandLine args) throws CommandFormatException
Returns the value of the argument specified on the command line. If the argument isn't specified the returned value is null. Although, it might throw IllegalArgumentException in case the argument is a required one.- Parameters:
args- parsed arguments.- Returns:
- the value of the argument or null if the argument isn't present or is missing value.
- Throws:
CommandFormatException
-
getValue
String getValue(ParsedCommandLine args, boolean required) throws CommandFormatException
Returns the value of the argument specified on the command line. If the argument isn't specified and the value is not required null is returned. Otherwise an exception is thrown.- Parameters:
args- parsed arguments.required- whether the value for this argument is required.- Returns:
- the value of the argument or null if the argument isn't present and the value is not required.
- Throws:
CommandFormatException
-
isValueComplete
boolean isValueComplete(ParsedCommandLine args) throws CommandFormatException
Checks whether the value is specified and complete. The value is considered complete only if it is followed by a separator (argument separator, end of argument list but not end-of-content).- Parameters:
args- the parsed arguments- Returns:
- true if the value of the argument is complete, false otherwise.
- Throws:
CommandFormatException
-
isValueRequired
boolean isValueRequired()
Checks whether the argument accepts value.- Returns:
- true if this argument accepts a value, otherwise false.
-
getValueCompleter
CommandLineCompleter getValueCompleter()
Returns the tab-completer for the value.- Returns:
- tab-completer for the value or null of none available.
-
-