Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ntjess opened this issue May 17, 2020 · 0 comments
Open

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

ntjess opened this issue May 17, 2020 · 0 comments

Comments

@ntjess
Copy link

@ntjess ntjess commented May 17, 2020

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!

@ntjess ntjess changed the title `--help` doesn't work on functions with `**kwargs` and all default args --help doesn't work on functions with **kwargs and all default args May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.