Reputation: 105
I see this strange python function
@click.group()
def main():
pass
It is the main entrance function, but why does it do nothing?
Upvotes: 0
Views: 42
Reputation: 34282
If a function is decorated with @click.group
, a Group
is created, and can later be used to add subcommands, e.g.:
@click.group()
def main():
pass
@main.command()
def sub():
print('I am a subcommand')
The group function doesn't have to do anything itself, if you don't need additional logic or default logic without a subcommand.
Upvotes: 1