commandlineparser / commandlineparser/commandline
Option without value should throw an error.
- Lenguaje dominante
- C#
- Estrellas
- 4.8k
- Forks
- 478
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
If I have a string option and it is called without a value, no error is thrown. This is what I would expect.
```csharp
using CommandLine;
namespace cli
{
public class Program
{
static void Main(string[] args)
{
CommandLine.Parser.Default.ParseArguments(args)
.WithParsed(options => RunOptions(options))
.WithNotParsed(error => ErrorAndExit(error));
}
static void RunOptions(Options options)
{
}
static void ErrorAndExit(IEnumerable error)
{ }
}
public class Options
{
[Option("value", Required = false, HelpText = "A value.")]
public string Value { get; set; }
}
}
```
If i call this command line i get no error.
```bash
cli --value # should throw an error
cli --value blah # ok, this is what i want
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.