2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

chore: add overwrite flag, repo_name format, and exit gracefully

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay D. Pai 2020-02-25 11:45:03 +05:30
parent cac66a6b88
commit 0c0ed767f7
No known key found for this signature in database
GPG Key ID: 75507BE256F40CED
2 changed files with 3 additions and 3 deletions

View File

@ -123,13 +123,13 @@ def get_app(git_url, branch=None, bench_path='.', build_asset_files=True, verbos
# application directory already exists
# prompt user to overwrite it
if overwrite or click.confirm('''A directory for the application "{0}" already exists.
Do you want to continue and overwrite it?'''):
Do you want to continue and overwrite it?'''.format(repo_name)):
shutil.rmtree(os.path.join(bench_path, 'apps', repo_name))
elif click.confirm('''Do you want to reinstall the existing application?''', abort=True):
app_name = get_app_name(bench_path, repo_name)
print("Reinstalling {0}".format(app_name))
install_app(app=app_name, bench_path=bench_path, verbose=verbose, build_asset_files=build_asset_files)
sys.exit(1)
sys.exit()
logger.info('Getting app {0}'.format(repo_name))
exec_cmd("git clone {git_url} {branch} {shallow_clone} --origin upstream".format(

View File

@ -36,7 +36,7 @@ def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups,
@click.argument('git-url')
@click.option('--branch', default=None, help="branch to checkout")
@click.option('--overwrite', is_flag=True)
def get_app(git_url, branch, name=None):
def get_app(git_url, branch, overwrite, name=None):
"clone an app from the internet and set it up in your bench"
from bench.app import get_app
get_app(git_url, branch=branch, overwrite=overwrite)