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

Automatically showing help using default command #951

Closed
krisrok opened this issue Sep 7, 2022 · 0 comments · Fixed by #953
Closed

Automatically showing help using default command #951

krisrok opened this issue Sep 7, 2022 · 0 comments · Fixed by #953
Assignees
Labels

Comments

@krisrok
Copy link
Contributor

krisrok commented Sep 7, 2022

As some users pointed out in #702 it'd be nice to also show the help/usage when using a default command like here:

var app = new CommandApp<DoStuffCommand>();
app.Run(args);

When run without any arguments given it currently only shows:

Error: Missing required argument 'myArgument'.

It only works when adding it as a regular command

var app = new CommandApp();
app.Configure(c => c.AddCommand<DoStuffCommand>("run"));
app.Run(args);

But as it is the only command this name is totally redundant and the help showing up is unneccessarily hard to read:

USAGE:
    App.exe [OPTIONS] <COMMAND>

OPTIONS:
    -h, --help       Prints help information
    -v, --version    Prints version information

COMMANDS:
    run <myArgument> [myOtherArgument]

Instead of just showing the missing argument error I'd much rather like it to automatically (or switchable by config) render the help like when called with -h.

Forgive me if I overlooked how to do this correctly if there's already a way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done 🚀
Development

Successfully merging a pull request may close this issue.

2 participants