Skip to content

Add alias for description attribute in Command annotation #1300

@ullenboom

Description

@ullenboom

Over the last major versions, Spring Shell introduced several breaking conceptual and syntactic changes:

  • @ShellComponent@Component
  • @ShellMethod@Command
  • Description has to be set via annotation attribute
  • @Argument and @Option are now mandatory
  • -- is now required for command invocation

The first set of changes is understandable. But ...

An alias for description would be nice (restore to SS 3 behavior):

public @interface Command {

	/**
	 * Alias for {@link #description()}.
	 * Allows using {@code @Command("...")} as shorthand.
	 */
	@AliasFor("description")
	String value() default "";

	/**
	 * Define a command description.
	 * @return the command description
	 */
	@AliasFor("value")
	String description() default "";
...
}

As noted in #1287, it should be possible to omit the @Argument annotation.

If a command has no subcommands and the invocation is unambiguous, the -- separator should be optional (behavior as in SS 3). The documentation seems to point to writing a custom parser; if so, that feels like a workaround rather than a general solution.

Overall, simplifying these cases would reduce the number of required changes in existing code. Otherwise, the mandatory use of -- forces updates to user-facing documentation in every project that relies on Spring Shell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions