[Fix] Added --yes or -y to bypass confirmation prompt to uninstall-app from site

This commit is contained in:
shreyas 2016-08-05 16:53:51 +05:30
parent 6bea61f7ce
commit dac00c0fe6
2 changed files with 5 additions and 4 deletions

View file

@ -285,16 +285,17 @@ def remove_from_installed_apps(context, app):
@click.command('uninstall-app')
@click.argument('app')
@click.option('--yes', '-y', help='To bypass confirmation prompt for uninstalling the app', is_flag=True, default=False, multiple=True)
@click.option('--dry-run', help='List all doctypes that will be deleted', is_flag=True, default=False)
@pass_context
def uninstall(context, app, dry_run=False):
def uninstall(context, app, dry_run=False, yes=False):
"Remove app and linked modules from site"
from frappe.installer import remove_app
for site in context.sites:
try:
frappe.init(site=site)
frappe.connect()
remove_app(app, dry_run)
remove_app(app, dry_run, yes)
finally:
frappe.destroy()

View file

@ -163,10 +163,10 @@ def remove_from_installed_apps(app_name):
if frappe.flags.in_install:
post_install()
def remove_app(app_name, dry_run=False):
def remove_app(app_name, dry_run=False, yes=False):
"""Delete app and all linked to the app's module with the app."""
if not dry_run:
if not dry_run and not yes:
confirm = raw_input("All doctypes (including custom), modules related to this app will be deleted. Are you sure you want to continue (y/n) ? ")
if confirm!="y":
return