I'm using click
to build a CLI in Python. I have several options to the command I'm defining, and I want some of them to be hidden in --help
. How can I do that?
Asked
Active
Viewed 6,795 times
17

Vadim Kotov
- 8,084
- 8
- 48
- 62

Ram Rachum
- 84,019
- 84
- 236
- 374
2 Answers
16
Yes, you can. Use
@click.option(..., hidden=True)
The feature is now (March 2019) in the stable release of Click.
Please note: In the first implementation the functionality was realised with a parameter show=False
, but is now done with hidden=True
.

halloleo
- 9,216
- 13
- 64
- 122
-
3For info, you can also do the same on commands: `@click.command(..., hidden=true)` – al. May 01 '19 at 03:41
-
2Documentation link: https://click.palletsprojects.com/en/7.x/api/?highlight=hidden#click.Option – rcoup Jun 17 '19 at 11:34
3
This feature is on the verge of being included in click, you can follow the development here:

Merlijn Sebrechts
- 545
- 1
- 5
- 16
-
2The pull request still isn't available as of 2016-11-11, but according to comments should be in the 7.x version when that comes out. – b-jazz Nov 11 '16 at 18:21