commandlineparser / commandlineparser/commandline

Set to true nullable bool arguments without the value

Open
#316 12 comments 7 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
4.8k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

Consider the following class:

```csharp
class Parameters
{
[Option("bool")]
public bool Bool { get; set; }

[Option("nullable-bool")]
public bool? NullableBool { get; set; }
}
```

It works fine for such arguments: `--bool --nullable-bool true` but doesn't work for `--bool --nullable-bool`.

I suggest making it working for nullable bool types.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the behavior with the Parameters class shown in the issue, comparing `--bool --nullable-bool true` with `--bool --nullable-bool`. Trace the command-line option parsing path for nullable bool properties; done means `--nullable-bool` sets NullableBool to true without requiring an explicit value, while existing boolean behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.