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

Click envvar defaults not shown #36

Closed
ewels opened this issue Mar 3, 2022 · 5 comments
Closed

Click envvar defaults not shown #36

ewels opened this issue Mar 3, 2022 · 5 comments

Comments

@ewels
Copy link
Owner

ewels commented Mar 3, 2022

I don't think that envvar is considered currently: https://click.palletsprojects.com/en/8.0.x/options/#values-from-environment-variables

See #26 (comment)

@ewels
Copy link
Owner Author

ewels commented May 16, 2022

Looks like click doesn't natively show this in the help, so not missing anything there:

$ python examples/click/09_envvar.py greet --help
Debug mode is off
Usage: 09_envvar.py greet [OPTIONS]

Options:
  --username TEXT
  --email TEXT
  --help           Show this message and exit.

But Typer does:

$ python examples/typer/03_envvar.py --help
Usage: 03_envvar.py [OPTIONS] COMMAND [ARGS]...

  My amazing tool does all the things.

  This is a minimal example based on documentation from the 'click' package.

  You can try using --help at the top level and also for specific group
  subcommands.

Options:
  --debug / --no-debug            Enable debug mode.  [default: no-debug]
  --bar TEXT                      Lorep ipsum.  [env var: FOO; default: False]
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.
  --help                          Show this message and exit.

I quite like the behaviour, so I think I'll add it as a default for both tools in the Typer style. I'll create an option to disable it.

@ewels
Copy link
Owner Author

ewels commented May 16, 2022

I quite like the behaviour, so I think I'll add it as a default for both tools in the Typer style. I'll create an option to disable it.

Never mind, there's a show_envvar argument in click.

@ewels ewels closed this as completed in d59d70c May 16, 2022
@taranlu-houzz
Copy link
Contributor

taranlu-houzz commented Jul 11, 2022

@ewels Is there a way to disable this behavior for the default generated --install-completion and --show-completion commands?

It appears that typer actually hides these by default as well.

@ewels
Copy link
Owner Author

ewels commented Jul 12, 2022

So many options 🙈 Could you make a new issue for this please?

@taranlu-houzz
Copy link
Contributor

@ewels Just created #84.

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