-
Notifications
You must be signed in to change notification settings - Fork 380
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
Bool arguments missing name in help page #1157
Comments
I tracked this down to #500, and more specifically: command-line-api/src/System.CommandLine/Help/HelpBuilder.cs Lines 529 to 533 in 4b43131
It looks like that change might be intended for when the |
The documentation doesn't seem to discuss positional arguments at all, I only found out about them when exploring the source... are they getting deprecated in favour of a flag on options or something similar? It took me a long time to figure out they even existed because I'm coming to this from PowerShell where an "argument" is just an "option" with an index so it its name is specified optionally, like in C# with the optional parameters. |
They're not getting deprecated. It sounds like we need to clarify this. I think the documentation doesn't call them out as "positional" because all arguments are positional in System.CommandLine. An option argument (part of an > myapp --verbose 123
^-^
Option argument A command argument is also positional but only relative to other command arguments, not to options. So given either of these command definitions: new RootCommand
{
new Option<bool>("--verbose"),
new Argument<int>(),
new Argument<string>()
} or new RootCommand
{
new Argument<int>(),
new Argument<string>(),
new Option<bool>("--verbose")
} , the following two command lines are equivalent: > myapp --verbose arg1 arg2 arg3
^------------^
Command arguments
> myapp arg1 arg2 arg3 --verbose
^------------^
Command arguments
Thoughts? |
Okay, I think I get it now - I'm just coming from mentally looking at this as like C# method calls and PowerShell cmdlets, both cases where the partition between "arguments" and "options" aren't as firm. |
Consider this application:
When calling this application with the
--help
parameter, we get an output like this:Notice how in the Arguments sections we see
<value2>
but not<value1>
. It seems it's not printed here because the type parameter isbool
.The text was updated successfully, but these errors were encountered: