Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding sub command description on generated usage help #333

Closed
ghost opened this issue Apr 8, 2018 · 3 comments
Closed

Adding sub command description on generated usage help #333

ghost opened this issue Apr 8, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Apr 8, 2018

The generated help with included subcommands, does not show how to apply the subcommand.

For example:

public class DemoApp {

    @Command(name = "demo", subcommands = DemoCmd.class)
    static class Demo implements Runnable {

        @Option(names = {"-h", "--help"}, usageHelp = true)
        private boolean help;

        public void run() {
            System.out.println("Print help message.");
        }
    }

    @Command(name = "cmd")
    static class DemoCmd implements Runnable {

        @ParentCommand
        private Demo parent;

        @Override
        public void run() {
            System.out.println("DONE");
        }
    }

    public static void main(String[] args) {
        CommandLine.run(new Demo(), System.out, "-h");
    }
}

prints to the console:

Usage: demo [-h]
  -h, --help
Commands:
  cmd

The user may be asking how to apply the subcommand since it is only showing demo [-h].

Could be possible to show for example:

Usage: demo [-h] [command]
@remkop
Copy link
Owner

remkop commented Apr 8, 2018

I think that's a good idea.
Do you think you can create a pull request for this?

@ghost
Copy link
Author

ghost commented Apr 8, 2018

I created the pull request #337 for this feature.

@remkop remkop added this to the 3.0 milestone Apr 8, 2018
@remkop
Copy link
Owner

remkop commented Apr 8, 2018

Nice work, thank you!
I merged the PR into master and this will be part of the upcoming 3.0 release (no timeline yet).

@remkop remkop closed this as completed in df518bc Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant