argparse with option/value like --gpg-options "--homedir=/home/user" errors out but adding binding op works.
未關閉
還沒有人認領這個 Issue。
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
--gpg-options is defined as follows:
gpg_options=dict(
metavar=_("options"),
action=SplitOptionsAction,
help="Verbatim gpg options. May be supplied multiple times.",
default=dflt(config.gpg_options),
),
This does not work (using space):
prog --gpg-options "--homedir=/home/user"
and gets argument --gpg-options: expected one argument
But this one does (using the binding op):
prog --gpg-options="--homedir=/home/user"
with gpg_options being set correctly.
The deprecated optparse handled this correctly.
See Also:
https://gitlab.com/duplicity/duplicity/-/issues/795
https://gitlab.com/duplicity/duplicity/-/issues/816
CPython versions tested on:
3.8, 3.9, 3.10, 3.11, 3.12
Operating systems tested on:
Linux, macOS
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從處理值以 -- 開頭的選項之 argparse 邏輯開始,使用回報的 --gpg-options "--homedir=/home/user" 命令作為重現案例。在 binding-operator 形式之外,加入對空格分隔形式的覆蓋,並確認該選項值在相關測試中能正確被接受。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- cli
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100