Skip to content

Documenting environment variables used for options #7

Open

Description

@nigelm

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

Activity

  1. added
    enhancement
    and removed on Dec 9, 2020
  2. florimondmanca commented on Dec 9, 2020

    @florimondmanca
    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?
  3. yudai-nkt commented on Dec 16, 2020

    @yudai-nkt
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions