Skip to content

Instantly share code, notes, and snippets.

@asksven
Created March 24, 2024 12:04
Show Gist options
  • Save asksven/ff67cd6fb00b72f2555a53ab2023970e to your computer and use it in GitHub Desktop.
Save asksven/ff67cd6fb00b72f2555a53ab2023970e to your computer and use it in GitHub Desktop.
import click
# Group for 'project' commands
@click.group()
def project():
pass
# Project commands
@project.command()
def list():
click.echo("Listing projects")
@project.command()
def create(name):
click.echo(f"Creating project: {name}")
@project.command()
def update(name):
click.echo(f"Updating project: {name}")
@project.command()
def add(name):
click.echo(f"Adding to project: {name}")
# Group for 'module' commands
@click.group()
def module():
pass
# Similarly define commands for 'module'
# ...
# Group for 'template' commands
@click.group()
def template():
pass
# Similarly define commands for 'template'
# ...
# Main CLI entry point
@click.group()
def cli():
pass
# Add groups to the main CLI
cli.add_command(project)
cli.add_command(module)
cli.add_command(template)
if __name__ == '__main__':
cli()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment