click-contrib / sphinx-click

A Sphinx plugin to automatically document click-based applications
MIT License
214 stars 57 forks source link

Ranges are not rendered in the generated docs #145

Open renaudjester opened 1 month ago

renaudjester commented 1 month ago

Hi! I am using the click.FloatRange and when using the --help the range is returned by click at the end of the help.

However with sphinx-click, it doesn't seem to appear in the documentation.

Here is a minimal example:

import click

@click.command()
@click.option("--number", type=click.FloatRange(0, 3), help="Your range")
def cli(number) -> None:
    print("Hello, world!")

if __name__ == "__main__":
    cli()

Running python small_example.py --help returns:

Usage: small_example.py [OPTIONS]

Options:
  --number FLOAT RANGE  Your range  [0<=x<=3]
  --help                Show this message and exit.

But this range cannot be seen in the documentation generated by sphinx-click.

Env: python==3.9.18 sphinx-click==6.0.0 click==8.1.7