commandlineparser / commandlineparser/commandline

Issue with boolean switch after verb

未關閉
#778 5 則留言 4 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C#
星號
4.8k
分支
478
PR 合併指標
30 天內沒有已合併 PR

描述

**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

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

先使用 `app.exe install --feature=false` 執行 issue 中連結的示範程式碼,並將回報的值與預期結果進行比較。追蹤 `install` 動詞和 `EnableFeature` 的布林選項處理;完成的標準是保留明確指定的 `false` 值,而不是將其替換為預設的 `true`。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp
領域
cli
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。