Skip to content

Instantly share code, notes, and snippets.

@nitrocode
Created March 8, 2018 23:46
Show Gist options
  • Select an option

  • Save nitrocode/c11d34cb3eaf31fbba0d9413698df300 to your computer and use it in GitHub Desktop.

Select an option

Save nitrocode/c11d34cb3eaf31fbba0d9413698df300 to your computer and use it in GitHub Desktop.
A really simple click implementation with groups
#!/usr/bin/env python
# Usage:
# python script.py idk
# python script.py whatever okay
import click
# the main group
@click.group()
def main():
click.echo('Keep it simple')
@main.command()
def idk():
click.echo('Idk')
@main.group()
def whatever():
click.echo('whatever')
@whatever.command()
def okay():
click.echo('okay')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment