Annotation Type Alias
-
@Target(TYPE) @Retention(RUNTIME) @Documented public @interface Alias
Specifies a command aliasThis annotation is used as arguments to the
Parser
annotation to specify command aliases which provide shortcuts to other commands.
-
-
-
arguments
java.lang.String[] arguments
Arguments for the alias i.e. how the alias should be expandedThese may be constants such as
{ "foo", "--bar" }
which would cause passing in the alias to be the same as passing in the argumentsfoo
and--bar
. Alternatively these may include positional parameters which are indicated as$N
whereN
is an index starting at 1.Where positional parameters are used then that parameter is expanded to take in the users inputs after the alias name into account. For example imagine an alias defined with arguments
{ "foo", "$2", "$1" }
, if the user invoked the alias asalias a b
then the alias gets expanded and the actual command invoked isfoo b a
. In the case where a positional parameter has no corresponding input provided it is left as-is which will usually result in parser errors.By default aliases may not refer to other aliases though the parser may be configured to allow this if desired. However even when allowed circular references are not permitted and will still result in a parser error.
- Returns:
- Arguments
-
-