dotnet / dotnet/command-line-api
Usage section shows Argument.Name rather than Argument.HelpName
- Lingua principale
- C#
- Stelle
- 3.7k
- Fork
- 428
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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:
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start in src/System.CommandLine/Help/HelpBuilder.cs at lines 296-304 and compare the Usage implementation with src/System.CommandLine/Help/HelpBuilder.Default.cs at lines 73-87, which renders the Arguments section. Use the provided demo to reproduce the inconsistent help output. Done means the Usage section displays Argument.HelpName when it is set, matching the Arguments section while preserving Argument.Name for binding.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100