commandlineparser / commandlineparser/commandline
Generate Help on a specific verb
- Linguagem predominante
- C#
- Estrelas
- 4.8k
- Forks
- 478
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
**Describe the bug**
When I call my program with the following arguments : "help verb1", I expect that the help for this specific verb was displayed. But instead, the help for all verbs are displayed.
**To Reproduce**
```
[Verb("Verb1", HelpText ="Help Verb1")]
internal class Verb1
{
[Option(Required = true, HelpText = "Help MyOption1")]
public string MyOption1 { get; set; }
}
[Verb("Verb2",HelpText = "Help Verb2")]
internal class Verb2
{
[Option(Required = true, HelpText = "Help MyOption2")]
public string MyOption2 { get; set; }
}
internal class Program
{
static void Main(string[] args)
{
var parser = new Parser(config => config.HelpWriter = null);
var parserResult = parser.ParseArguments<
Verb1,
Verb2
>
(args);
parserResult.MapResult(
(Verb1 options) => { return 0; },
(Verb2 options) => { return 0; },
errors => {
DisplayHelp(parserResult, errors);
return 0;
});
Console.ReadKey();
}
static void DisplayHelp(ParserResult result, IEnumerable errs)
{
var helpText = HelpText.AutoBuild(result, h =>
{
h.AdditionalNewLineAfterOption = false;
h.Heading = "Myapp 2.0.0-beta"; //change header
h.Copyright = "Copyright (c) 2019 Global.com"; //change copyright text
return HelpText.DefaultParsingErrorsHandler(result, h);
}, e => e, verbsIndex:true);
Console.WriteLine(helpText);
}
}
```
When I excecute this with the command line "MyApp.exe help verb1"
The actual result is :

**Expected behavior**
This display :
Verb2 Help Verb1
MyOption2 Help MyOption2
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Reproduce the issue with the shown Verb1 and Verb2 classes, then trace the result from ParseArguments through DisplayHelp, HelpText.AutoBuild, and DefaultParsingErrorsHandler. Check how the "help verb1" arguments are interpreted and how verbsIndex affects the output. Done means requesting help for one verb displays only that verb's help and options, with the existing all-verbs help behavior preserved.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- csharp
- Domínio
- cli
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100