-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add explicit mention of choices, add example and screenshots. See #33
- Loading branch information
Showing
4 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import rich_click as click | ||
|
||
click.rich_click.SHOW_METAVARS_COLUMN = False | ||
click.rich_click.APPEND_METAVARS_HELP = True | ||
|
||
|
||
@click.command() | ||
@click.option( | ||
"--debug/--no-debug", | ||
"-d/-n", | ||
default=False, | ||
help="""Enable debug mode.""", | ||
) | ||
@click.option( | ||
"--number", | ||
"-n", | ||
type=click.Choice( | ||
[ | ||
"one", | ||
"two", | ||
"three", | ||
"four", | ||
"five", | ||
"six", | ||
"seven", | ||
"eight", | ||
"nine", | ||
"ten", | ||
"eleven", | ||
"twelve", | ||
"thirteen", | ||
"fourteen", | ||
"fifteen", | ||
"sixteen", | ||
"seventeen", | ||
"eighteen", | ||
"nineteen", | ||
"twenty", | ||
"twenty-one", | ||
"twenty-two", | ||
"twenty-three", | ||
"twenty-four", | ||
"twenty-five", | ||
"twenty-six", | ||
"twenty-seven", | ||
"twenty-eight", | ||
"twenty-nine", | ||
"thirty", | ||
] | ||
), | ||
show_default=True, | ||
help="This click choice has loads of options.", | ||
) | ||
def cli(debug, number): | ||
""" | ||
My amazing tool does all the things. | ||
This is a minimal example based on documentation | ||
from the 'click' package. | ||
You can try using --help at the top level and also for | ||
specific group subcommands. | ||
""" | ||
print(f"Debug mode is {'on' if debug else 'off'}") | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |