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

Documenting environment variables used for options #7

Open
nigelm opened this issue Oct 22, 2020 · 2 comments
Open

Documenting environment variables used for options #7

nigelm opened this issue Oct 22, 2020 · 2 comments
Labels
discussion enhancement New feature or request

Comments

@nigelm
Copy link

nigelm commented Oct 22, 2020

Environment variables can be used to set option values:-

@click.option(
    "--debug/--no-debug",
    default=False,
    envvar="PRODUCT_DEBUG",
    help="Output debugging logging",
)

However these are not exposed in the CLI documentation.

It has to be admitted that Click's help text also does not expose these at all, so manual addition of this mapping to the docstrings may be needed anyhow.

Many thanks for this plugin for mkdocs - much appreciated

@florimondmanca florimondmanca added enhancement New feature or request rendering and removed rendering labels Dec 9, 2020
@florimondmanca
Copy link
Contributor

@nigelm That sounds like an interesting enhancement. A few questions:

  • What would you expect a sample updated rendered usage to be…?
  • Would this be something better discussed on the click repo, so that --help does output environment variables?

@yudai-nkt
Copy link
Contributor

FWIW, click.Option class has a parameter show_envvar and setting this to True should show an environment variable on the help page. A possible downside of this approach is that this parameter is False by default, so you need to explicitly set show_envvar to True each and every time if you want environment variables to appear in your document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants