commandlineparser / commandlineparser/commandline

Parser fails when an empty value is given

Aperta
#412 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
4.8k
Fork
478
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Example code

```C#
static class Program
{
static void Main(string[] args)
{
var configuration = new Configuration();
var parseResult = Parser.Default.ParseArguments(args).WithParsed(result => configuration = result);

System.Console.WriteLine(parseResult.Tag);
System.Console.WriteLine(configuration.Description);
}
}

internal class Configuration
{
[Option('d', "description", HelpText = "Set the description from the project")]
public string Description { get; set; }
}
```

Running the Program with `progam.exe --description=""` results in a Parse Error:

ERROR(S):
Token '--description=' is not recognized

This is probably the same issue as #358 - but the example syntaxt was different (--description without an equal sign), which is not what I expect. But I expect an empty string to be a valid value.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.