Support label with @Option
- Add `label` field into `@Option`. This sets option label if `label` field has any text. - Fixes #732
This commit is contained in:
@@ -70,6 +70,13 @@ public @interface Option {
|
||||
*/
|
||||
String description() default "";
|
||||
|
||||
/**
|
||||
* Return a label of the option.
|
||||
*
|
||||
* @return label of the option
|
||||
*/
|
||||
String label() default "";
|
||||
|
||||
/**
|
||||
* Define option arity.
|
||||
*
|
||||
|
||||
@@ -251,6 +251,9 @@ class CommandRegistrationFactoryBean implements FactoryBean<CommandRegistration>
|
||||
optionSpec.shortNames(shortNames.toArray(new Character[0]));
|
||||
optionSpec.position(mp.getParameterIndex());
|
||||
optionSpec.description(so.description());
|
||||
if (StringUtils.hasText(so.label())) {
|
||||
optionSpec.label(so.label());
|
||||
}
|
||||
int arityMin = so.arityMin();
|
||||
int arityMax = so.arityMax();
|
||||
if (arityMin > -1) {
|
||||
|
||||
Reference in New Issue
Block a user