forked from orbit-oss/flask
Improved support for composable cli
This commit is contained in:
parent
9ab5987100
commit
e059bf311c
1 changed files with 6 additions and 6 deletions
12
flask/cli.py
12
flask/cli.py
|
|
@ -139,9 +139,9 @@ class ScriptInfo(object):
|
||||||
to click.
|
to click.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, app_import_path=None, debug=None):
|
||||||
self.app_import_path = None
|
self.app_import_path = app_import_path
|
||||||
self.debug = None
|
self.debug = debug
|
||||||
self._loaded_app = None
|
self._loaded_app = None
|
||||||
|
|
||||||
def get_app_import_path(self):
|
def get_app_import_path(self):
|
||||||
|
|
@ -187,7 +187,7 @@ def without_appcontext(f):
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
||||||
class FlaskClickGroup(click.Group):
|
class FlaskGroup(click.Group):
|
||||||
"""Special subclass of the a regular click group that supports
|
"""Special subclass of the a regular click group that supports
|
||||||
loading more commands from the configured Flask app.
|
loading more commands from the configured Flask app.
|
||||||
"""
|
"""
|
||||||
|
|
@ -244,7 +244,7 @@ class FlaskClickGroup(click.Group):
|
||||||
self, ctx, cmd, cmd_name, args)
|
self, ctx, cmd, cmd_name, args)
|
||||||
|
|
||||||
|
|
||||||
cli = FlaskClickGroup(help='''\
|
cli = FlaskGroup(help='''\
|
||||||
This shell command acts as general utility script for Flask applications.
|
This shell command acts as general utility script for Flask applications.
|
||||||
|
|
||||||
It loads the application configured (either through the FLASK_APP environment
|
It loads the application configured (either through the FLASK_APP environment
|
||||||
|
|
@ -346,7 +346,7 @@ def main(as_module=False):
|
||||||
# the reloader can properly operate.
|
# the reloader can properly operate.
|
||||||
sys.argv = ['-m', this_module] + sys.argv[1:]
|
sys.argv = ['-m', this_module] + sys.argv[1:]
|
||||||
else:
|
else:
|
||||||
name = 'flask'
|
name = None
|
||||||
|
|
||||||
cli.main(args=args, prog_name=name, obj=ScriptInfo(),
|
cli.main(args=args, prog_name=name, obj=ScriptInfo(),
|
||||||
auto_envvar_prefix='FLASK')
|
auto_envvar_prefix='FLASK')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue