Skip to content

how to create a group named list/set, which is pthon build-in func #2666

Answered by davidism
m986883511 asked this question in Q&A
Discussion options

You must be logged in to vote

The first argument to the command and group decorators is a name. Otherwise, the decorator takes the name from the function. This way, you can avoid having function names that shadow built-in or other local names.

@click.group("list")
def list_group():
    pass

In Click 8.2, functions with names that end in _command, _cmd, _group, and _grp will use the name with those suffixes removed, so you won't have to specify the name manually.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@m986883511
Comment options

Answer selected by m986883511
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants