commandlineparser / commandlineparser/commandline
SplitArgs() extension method does not properly handle arguments with quoted values
- Lenguaje dominante
- C#
- Estrellas
- 4.8k
- Forks
- 478
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
I attempted to use SplitArgs() to split an string provided by a user while the console app is running (via Console.ReadLine()) and the result of it is different than if the user entered the string on the command prompt as part of launching.
Here is a concrete example:
`myprogram.exe cool-command --arg1="Howdy Partner" --arg2=arg_without_spaces`
Entering this from the command prompt will give you the following args in the args[] array.
* `cool-command`
* `--arg1=Howdy Partner`
* `--arg2=arg_without_spaces`
while SplitArgs() will give me the following
* `cool-command`
* `--arg1="Howdy Partner`
* `--arg2=arg_without_spaces`
Notice there is a quote before Howdy Partner and there is no trailing quote. I would expect no quotes at all.
I looked into alternate implementation and found this which worked correctly for me: https://stackoverflow.com/a/64236441/1571903
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Encuentra el método de extensión SplitArgs() y reproduce el problema con el ejemplo de línea de comandos, comparando su salida con el array args esperado. La tarea está terminada cuando los valores entre comillas se devuelven sin las comillas circundantes y el valor completo permanece como un solo argumento, incluso al analizar la entrada de Console.ReadLine().
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
- Bastante claro
- Aptitud para principiantes
- 45/100