Created
April 28, 2016 20:01
-
-
Save jezdez/5eed32e686bf69e89325e99d073646da to your computer and use it in GitHub Desktop.
Patch Click to use a Flask 1.0 AppGroup by default to get automatic app context for commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
try: | |
from flask.cli import AppGroup | |
except ImportError: | |
from flask_cli import AppGroup | |
def group(name=None, **attrs): | |
"""The same as ``click.grop`` but sets the default command class | |
to ``flask.cli.AppGroup`` | |
""" | |
attrs.setdefault('cls', AppGroup) | |
return click.command(name, **attrs) | |
click.group = group |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment