commandlineparser / commandlineparser/commandline

Issue when turning off AutoHelp or AutoVersion

Abierto
#821 0 comentarios 5 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C#
Estrellas
4.8k
Forks
478
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Empieza siguiendo Parser.MakeParserResult hasta DisplayHelp y HelpText.AutoBuild, usando como caso inicial los valores de ParserSettings de la reproducción. Reproduce el comportamiento de la ayuda generada y del verbo de versión, y después verifica que las opciones AutoHelp y AutoVersion deshabilitadas se reflejen de forma coherente en los comandos mostrados.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp
Área
cli
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.