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

[feature request] Exclude function (kw)args from synopsis, arguments and flags in help output #465

Open
eelkevdbos opened this issue Sep 29, 2023 · 0 comments

Comments

@eelkevdbos
Copy link

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.
def my_function(a: bool, _complex_type: ComplexType = ComplexType()):
  ...
  1. limit args and kwargs to literal types
fire.Fire(help_include_literals_only=True)
  1. provide the means to exclude arguments based on module or instance type, e.g.
def my_function(a: bool, s: service.ComplexType):
  ...

fire.Fire(
  help_exclude_arg_types=[service.ComplexType],
  help_exclude_arg_modules=[service]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants