[feature request] Exclude function (kw)args from synopsis, arguments and flags in help output
- 主要語言
- Python
- 星號
- 28.2k
- 分支
- 1.5k
- PR 合併指標
- 30 天內沒有已合併 PR
描述
The help output lists all function (keyword) arguments in the synopsis, arguments and flags.
In my specific use case, I would like to exclude some of those arguments, because they are:
1. of non-literal type, and therefore not easily provided through the means of CLI
2. injected by a dependency injection decorator
The option to exclude (keyword) arguments could be done in a couple of ways:
1. prefix the argument name with an underscore, e.g.
```python
def my_function(a: bool, _complex_type: ComplexType = ComplexType()):
...
```
2. limit args and kwargs to literal types
```python
fire.Fire(help_include_literals_only=True)
```
3. provide the means to exclude arguments based on module or instance type, e.g.
```python
def my_function(a: bool, s: service.ComplexType):
...
fire.Fire(
help_exclude_arg_types=[service.ComplexType],
help_exclude_arg_modules=[service]
)
```
貢獻指南
研究方向
該 issue 未指定檔案、測試或進入點。首先定位建構說明摘要、引數和旗標的程式碼,然後比較所提出的底線排除、僅常值排除以及型別/模組排除方案。完成的要求是確定一個取得共識的排除 API,並透過測試證明,被排除的關鍵字引數不再出現在每個說明區段中。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- cli
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 30/100