I have the following code:
import click
@click.group()
def cli():
pass
@click.command()
def initdb():
click.echo('Initialized the database')
@click.command()
def dropdb():
click.echo('Dropped the database')
cli.add_command(initdb)
cli.add_command(dropdb)
At the command line I want to be able to do something like the following:
python clicktest.py cli initdb
and have the following happen echo at the terminal:
Initialized the database
Or to enter into the terminal:
python clicktest.py cli dropdb
and have the following happen on the terminal:
Dropped the database
My problem is currently when I do this at the terminal:
python clicktest.py cli initdb
Nothing happens at the terminal, nothing prints when I think something should, namely the 'Initialized Database' echo. What am i doing wrong??