From 0c0ed767f73738e19692e4ea7667f0be5b7c05b7 Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Tue, 25 Feb 2020 11:45:03 +0530 Subject: [PATCH] chore: add overwrite flag, repo_name format, and exit gracefully Signed-off-by: Chinmay D. Pai --- bench/app.py | 4 ++-- bench/commands/make.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bench/app.py b/bench/app.py index b590fbf3..841c3800 100755 --- a/bench/app.py +++ b/bench/app.py @@ -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( diff --git a/bench/commands/make.py b/bench/commands/make.py index c2d27431..cd7738cd 100755 --- a/bench/commands/make.py +++ b/bench/commands/make.py @@ -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)