diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index bb900590e3..ab8597832d 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -223,15 +223,16 @@ def export_csv(context, doctype, path): frappe.destroy() @click.command('export-fixtures') +@click.option('--app', default=None, help='Export fixtures of a specific app') @pass_context -def export_fixtures(context): +def export_fixtures(context, app=None): "Export fixtures" from frappe.utils.fixtures import export_fixtures for site in context.sites: try: frappe.init(site=site) frappe.connect() - export_fixtures() + export_fixtures(app=app) finally: frappe.destroy() diff --git a/frappe/utils/fixtures.py b/frappe/utils/fixtures.py index fd57919cf7..8445450f94 100644 --- a/frappe/utils/fixtures.py +++ b/frappe/utils/fixtures.py @@ -50,9 +50,13 @@ def import_custom_scripts(app): "script": script }).insert() -def export_fixtures(): +def export_fixtures(app=None): """Export fixtures as JSON to `[app]/fixtures`""" - for app in frappe.get_installed_apps(): + if app: + apps = [app] + else: + apps = frappe.get_installed_apps() + for app in apps: for fixture in frappe.get_hooks("fixtures", app_name=app): filters = None or_filters = None