google / google/python-fire

--help doesn't work on functions with **kwargs and all default args

Ouverte
#258 1 commentaire 2 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
28.2k
Forks
1.5k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Consider the following example:

```
import fire

def test(a=1, b=1):
"""
Returns the sum of a and b.

:param a: The first parameter
:param b: The second parameter
"""
return a + b

fire.Fire(test)
```

If the file is called using `python ./myFile.py --help`, the help signature is printed as expected

However, if `**kwargs` is added to the signature of `test`, the return value of the function is printed instead. Is this expected behavior? It works if I run `python ./myFile.py -- --help`, but for someone using my application and not familiar with the 'fire' CLI, this is non-intuitive.

How do I need to modify `test` so that if someone calls `--help` on it, the help signature is printed?

Thanks!

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.