

@cli_app.command('create-app')
@click.option('--name', prompt='Your new app name', help='Your application name, directory will have this name')
@click.option('--engine', prompt='Your engine type, SQLAlchemy or MongoEngine', type=click.Choice(['SQLAlchemy', 'MongoEngine']), default='SQLAlchemy', help='Write your engine type')
def create_app(name, engine):
    '\n        Create a Skeleton application (needs internet connection to github)\n    '
    try:
        if (engine.lower() == 'sqlalchemy'):
            url = urlopen(SQLA_REPO_URL)
            dirname = 'Flask-AppBuilder-Skeleton-master'
        elif (engine.lower() == 'mongoengine'):
            url = urlopen(MONGOENGIE_REPO_URL)
            dirname = 'Flask-AppBuilder-Skeleton-me-master'
        zipfile = ZipFile(BytesIO(url.read()))
        zipfile.extractall()
        os.rename(dirname, name)
        click.echo(click.style('Downloaded the skeleton app, good coding!', fg='green'))
        return True
    except Exception as e:
        click.echo(click.style('Something went wrong {0}'.format(e), fg='red'))
        if (engine.lower() == 'sqlalchemy'):
            click.echo(click.style('Try downloading from {0}'.format(SQLA_REPO_URL), fg='green'))
        elif (engine.lower() == 'mongoengine'):
            click.echo(click.style('Try downloading from {0}'.format(MONGOENGIE_REPO_URL), fg='green'))
        return False

dataset/ETHPy150Open dpgaspar/Flask-AppBuilder/flask_appbuilder/console.py create_app/original