Skip to content

Format of "mycommand --help" and "help mycommand" #1373

Description

@tschoellhorn

I use Spring Boot 4.0.3.

When defining a Command with the @Command-Annotation it is possible to set a "help"-text. Currently this text is displayed when using the "--help" option. But: This text is displayed without parameters, options and synopsis. Consider this case:

@CommandGroup(name = "samples", prefix = "samples")
@Component
public class SampleCommand {
	@Command(
		name = "bar", 
		description = "Description of 'bar'", 
		help = "Help of 'bar'")
	public void bar(
		@Arguments List<Integer> values, 
		@Option String name) {
		System.out.println("do it : " + name);
		System.out.println("values: " + values);
	}
}

When running samples bar --help the output is:

Help of 'bar'

But when running help samples bar this output is produced:

NAME
        samples bar - Description of 'bar'

SYNOPSIS
        samples bar --name String --help

OPTIONS
        --name String

        [Optional, default = ]

        --help or -h
        help for samples bar
        [Optional]

In the later variant the text of the @Command.help is completely ignored. I suggest the following:

1.) The output of both "help" variants should be same - the base for that could be the help samples bar version.
2.) The @Command.help text should be integrated in that output.

I saw other issues which implicitely mentioned the same idea. This would streamline the help output.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/need-triageTeam needs to triage and take a first look

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions