Browse Source

Improved support for composable cli

pull/1040/head
Armin Ronacher 11 years ago
parent
commit
e059bf311c
  1. 12
      flask/cli.py

12
flask/cli.py

@ -139,9 +139,9 @@ class ScriptInfo(object):
to click.
"""
def __init__(self):
self.app_import_path = None
self.debug = None
def __init__(self, app_import_path=None, debug=None):
self.app_import_path = app_import_path
self.debug = debug
self._loaded_app = None
def get_app_import_path(self):
@ -187,7 +187,7 @@ def without_appcontext(f):
return f
class FlaskClickGroup(click.Group):
class FlaskGroup(click.Group):
"""Special subclass of the a regular click group that supports
loading more commands from the configured Flask app.
"""
@ -244,7 +244,7 @@ class FlaskClickGroup(click.Group):
self, ctx, cmd, cmd_name, args)
cli = FlaskClickGroup(help='''\
cli = FlaskGroup(help='''\
This shell command acts as general utility script for Flask applications.
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.
sys.argv = ['-m', this_module] + sys.argv[1:]
else:
name = 'flask'
name = None
cli.main(args=args, prog_name=name, obj=ScriptInfo(),
auto_envvar_prefix='FLASK')

Loading…
Cancel
Save