Interface CommandRegistration.OptionSpec
- All Known Implementing Classes:
CommandRegistration.DefaultOptionSpec
- Enclosing interface:
- CommandRegistration
public static interface CommandRegistration.OptionSpec
Spec defining an option.
-
Method Summary
Modifier and TypeMethodDescriptionand()
Return a builder for chaining.arity
(int min, int max) Define anarity
for an option.Define anarity
for an option.completion
(CompletionResolver completion) Define acompletion function
for an option.defaultValue
(String defaultValue) Define adefaultValue
for an option.description
(String description) Define adescription
for an option.Define alabel
for an option.Define long option names.nameModifier
(Function<String, String> modifier) Define an option name modifier.Define an optional hint for possible positional mapping.required()
Define option to be required.required
(boolean required) Define if option is required.shortNames
(Character... names) Define short option names.Define a type for an option.type
(org.springframework.core.ResolvableType type) Define aResolvableType
for an option.
-
Method Details
-
longNames
Define long option names.- Parameters:
names
- the long option names- Returns:
- option spec for chaining
-
shortNames
Define short option names.- Parameters:
names
- the long option names- Returns:
- option spec for chaining
-
type
Define a type for an option. This method is a shortcut fortype(ResolvableType)
which is a preferred way to define type with generics. Will override one fromtype(ResolvableType)
.- Parameters:
type
- the type- Returns:
- option spec for chaining
- See Also:
-
type
Define aResolvableType
for an option. This method is a preferred way to define type with generics. Will override one fromtype(Type)
.- Parameters:
type
- the resolvable type- Returns:
- option spec for chaining
-
description
Define adescription
for an option.- Parameters:
description
- the option description- Returns:
- option spec for chaining
-
required
Define if option is required.- Parameters:
required
- the required flag- Returns:
- option spec for chaining
-
required
CommandRegistration.OptionSpec required()Define option to be required. Syntatic sugar callingrequired(boolean)
withtrue
.- Returns:
- option spec for chaining
-
defaultValue
Define adefaultValue
for an option.- Parameters:
defaultValue
- the option default value- Returns:
- option spec for chaining
-
position
Define an optional hint for possible positional mapping.- Parameters:
position
- the position- Returns:
- option spec for chaining
-
arity
Define anarity
for an option.- Parameters:
min
- the min aritymax
- the max arity- Returns:
- option spec for chaining
-
arity
Define anarity
for an option.- Parameters:
arity
- the arity- Returns:
- option spec for chaining
-
label
Define alabel
for an option.- Parameters:
label
- the label- Returns:
- option spec for chaining
-
completion
Define acompletion function
for an option.- Parameters:
completion
- the completion function- Returns:
- option spec for chaining
-
nameModifier
Define an option name modifier.- Parameters:
modifier
- the option name modifier function- Returns:
- option spec for chaining
-
and
Return a builder for chaining.- Returns:
- a builder for chaining
-