[feature request] Exclude function (kw)args from synopsis, arguments and flags in help output
- Vorherrschende Sprache
- Python
- Sterne
- 28.2k
- Forks
- 1.5k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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]
)
```
Beitragsleitfaden
Rechercherichtung
Das Issue nennt keine Dateien, Tests oder Einstiegspunkte. Beginne damit, den Code zu lokalisieren, der Hilfezusammenfassungen, Argumente und Flags erstellt, und vergleiche dann die vorgeschlagenen Ansätze zum Ausschluss von Unterstrichen, nur Literalen sowie Typen/Modulen. Für den Abschluss sind eine vereinbarte API zum Ausschließen und Tests erforderlich, die zeigen, dass ausgeschlossene Schlüsselwortargumente nicht mehr in jedem Hilfeabschnitt erscheinen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- cli
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100