commandlineparser / commandlineparser/commandline

Issue with boolean switch after verb

Open
#778 5 comments 4 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.8k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

**Issue**
When using a boolean switch after a verb, I cannot set it to false

**Example:**
app.exe install --feature=false

**Options class**

```
[Verb("install", HelpText = "Install something")]
class Options
{
[Option('f', "feature", Required = false, Default = true, HelpText = "Enable a feature")]
public bool EnableFeature { get; set; }
}
```

**Expected:**
Feature = False

**Actual result:**
Feature = True

**Demo code:**
[https://dotnetfiddle.net/lSBqxp](https://dotnetfiddle.net/lSBqxp)

**Edit1**
Add Options class code

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.