Thanks to visit codestin.com
Credit goes to github.com

Skip to content

No --help flag in CLI doc. #148

Open
@KalebCoberly

Description

@KalebCoberly

The doc output for the click directive includes the args I add, but not the --help flag.

For instance, with this example:

@click.command()
@click.option(
    "--secs", type=int, required=False, default=1, help="Number of seconds to wait."
)
@typechecked
def main(secs: int = 1) -> None:
    """Wait n seconds."""
    example.wait_a_second(secs=secs)

I include the click directive in a doc:

.. click:: reference_package.cli.example:main
   :prog: example
   :nested: full

And, I only get the --secs arg in my doc.

But, of course, --help is a legit flag, and it shows up when using itself:

$ example --help
Usage: example [OPTIONS]

  Wait n seconds.

Options:
  --secs INTEGER  Number of seconds to wait.
  --help          Show this message and exit.

My users are inexperienced and may not always know/remember that --help is a thing. I can manually add an example of using --help to every doc, but is there a way to include --help in the doc output for the click directive?

Versions:

  • Python: 3.12
  • click: 8.1.8
  • sphinx-click 6.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions