commandlineparser / commandlineparser/commandline

Issue when turning off AutoHelp or AutoVersion

Aberta
#821 0 comentários 5 reações 0 responsáveis Ver no GitHub
Linguagem predominante
C#
Estrelas
4.8k
Forks
478
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

**Symptom**

When turning off AutoVersion (or AutoHelp) in the `ParserSettings`, the HelpText still announces these commands as being available.

**Root cause**

In the `Parser` Class, the method `MakeParserResult` is called, which may call `DisplayHelp`.

`DisplayHelp` calls `HelpText.AutoBuild`, which creates a HelpText instance with `AutoVersion` and `AutoHelp` always set to `true` no matter which value has been set in the `ParserSettings` instance.

**How to reproduce**

```
public static class Program {

[Verb("do")]
public class Options {
[Option("what")]
public string What { get; set; }
}

static void Main(string args[]){
Parser p = new Parser(s => { s.AutoVersion = false });
ParserResult r = p.Parse(args, typeof(Options));

}
}
```

Calling the project without any options results in a helptext that includes the 'version' command, which is officially turned of.

If the user then calls the application with the version verb, an error is produced, since the version verb is not known.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Comece rastreando Parser.MakeParserResult até DisplayHelp e HelpText.AutoBuild, usando os valores de ParserSettings da reprodução como caso inicial. Reproduza o comportamento da ajuda gerada e do verbo de versão e, em seguida, verifique se as configurações desabilitadas AutoHelp e AutoVersion são refletidas de forma consistente nos comandos exibidos.

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
Claramente especificada
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.