Skip to content

Commit 6c4035d

Browse files
committed
Add alias for description attribute in Command annotation
Resolves #1300
1 parent fe786cf commit 6c4035d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • spring-shell-core/src/main/java/org/springframework/shell/core/command/annotation

spring-shell-core/src/main/java/org/springframework/shell/core/command/annotation/Command.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.lang.annotation.Target;
2323

2424
import org.springframework.aot.hint.annotation.Reflective;
25+
import org.springframework.core.annotation.AliasFor;
2526

2627
/**
2728
* Annotation marking a method to be a shell command. The declaring class should be
@@ -36,6 +37,13 @@
3637
@Reflective
3738
public @interface Command {
3839

40+
/**
41+
* Alias for {@link #description}. Allows using
42+
* {@code @Command("My command description")} as shorthand.
43+
*/
44+
@AliasFor(attribute = "description")
45+
String value() default "";
46+
3947
/**
4048
* Define command as an array. Given that command should be {@code command1 sub1} it
4149
* can be defined as:
@@ -73,6 +81,7 @@
7381
* Define a command description.
7482
* @return the command description
7583
*/
84+
@AliasFor(attribute = "value")
7685
String description() default "";
7786

7887
/**

0 commit comments

Comments
 (0)