dotnet / dotnet/command-line-api

Usage section shows Argument.Name rather than Argument.HelpName

Open
#2,004 1 comment 0 reactions 0 assignees View on GitHub
Area-Help bug
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

In the help output, the Usage section shows Argument.Name, but the Arguments section shows Argument.HelpName. I think this is inconsistent and they should both use Argument.HelpName if set, so that Argument.Name would be culture-invariant and usable for System.CommandLine.NamingConventionBinder.

## Demo

```XML


Exe
net7.0
enable
enable



```

```
using System.CommandLine;
using System.IO;

var command = new RootCommand()
{
new Argument(name: "inputfile")
{
HelpName = "inputfile.log",
},
};

return await command.InvokeAsync(args);
```

```
$ dotnet run
Required argument missing for command: 'ArgumentHelpDemo'.

Description:

Usage:
ArgumentHelpDemo [options]

Arguments:

Options:
--version Show version information
-?, -h, --help Show help and usage information
```

## Current implementation

Usage section:

Arguments section:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.