commandlineparser / commandlineparser/commandline

Converting from 1.9.71 to 2.9.1, having issues.

Abierto
#846 0 comentarios 0 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

Hello. I am attempting to upgrade my commandlineparser code to the latest version and I am struggling.

The program's requirements are pretty simple: must have one and only one parameter, with a choice between two options.

Here is what I would ultimately like to have:

[Option("daysback", Required = false, Group = "onerequired", SetName = "daysback", Min = 0, Max = 999, HelpText = "Number of days back in time for run date.")]
public int? DaysBack { get; set; }

[Option("date", Required = false, Group = "onerequired", SetName = "date", HelpText = "Specific date for run date (yyyymmdd).")]
public string RunDate { get; set; }

Group would require at least one parameter, setname would make them mutually exclusive, max and min would check a value.

Unfortunately (according to docs), group and setname cannot be used together, so I had to drop group. And, min/max cannot be used on an int argument, so also dropped.

So now we look like this:

[Option("daysback", Required = false, SetName = "daysback", HelpText = "Number of days back in time for run date.")]
public int? DaysBack { get; set; }

[Option("date", Required = false, SetName = "date", HelpText = "Specific date for run date (yyyymmdd).")]
public string RunDate { get; set; }

Which is okay, but means that I have more checking to do myself.

Two questions please:

1. As is, this will parse cleanly if no arguments are given. Is there a way to set max/min number of required arguments?
2. Is there a way to generate the help screen text on demand? If I find argument errors with my post-parse checking, I'd like to output the same help screen that commandlineparser does.

Thanks.

Bryan Hunt

Guía de contribución

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

Línea de trabajo

No se nombran archivos ni pruebas. Empieza revisando la documentación sobre la validación de opciones de línea de comandos y la generación de ayuda referenciada en el issue; después, sigue el manejo actual de los grupos de opciones, los conjuntos, las restricciones numéricas y la salida de ayuda; al terminar, debería quedar establecido si se admiten los dos comportamientos solicitados y documentado o implementado un camino claro para ellos.

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

Evaluación

Stack tecnológico
csharp
Área
cli
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.