Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask CLI commands and arguments

How do you let a Flask CLI command accept an argument?

Flask seems to customise the Click Group object, so this doesn't work:

@app.cli.command()
@app.cli.argument('email')
def user_info(email):
    ...
like image 353
Tom Avatar asked Jun 23 '17 12:06

Tom


1 Answers

@app.cli.command is only to tell the click about this user_info. If you want the arguments and other click functionality please use click as well.

@app.cli.command()
@click.option('--email')
def user_info(email):
    ...
like image 161
Raja Simon Avatar answered Oct 23 '22 01:10

Raja Simon