From d09d4483606c2e8c5d16a66ffc9e3dc3bda4928f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 4 Jul 2016 15:18:52 +0530 Subject: [PATCH] [command] bench src --- bench/commands/__init__.py | 3 ++- bench/commands/utils.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bench/commands/__init__.py b/bench/commands/__init__.py index 64526956..60861e63 100644 --- a/bench/commands/__init__.py +++ b/bench/commands/__init__.py @@ -30,7 +30,7 @@ bench_command.add_command(switch_to_v5) from bench.commands.utils import (start, restart, set_nginx_port, set_ssl_certificate, set_ssl_certificate_key, set_url_root, set_mariadb_host, set_default_site, download_translations, shell, backup_site, backup_all_sites, release, renew_lets_encrypt, - disable_production) + disable_production, bench_src) bench_command.add_command(start) bench_command.add_command(restart) bench_command.add_command(set_nginx_port) @@ -46,6 +46,7 @@ bench_command.add_command(backup_all_sites) bench_command.add_command(release) bench_command.add_command(renew_lets_encrypt) bench_command.add_command(disable_production) +bench_command.add_command(bench_src) from bench.commands.setup import setup bench_command.add_command(setup) diff --git a/bench/commands/utils.py b/bench/commands/utils.py index a24051e8..3ebab0bf 100644 --- a/bench/commands/utils.py +++ b/bench/commands/utils.py @@ -135,3 +135,10 @@ def disable_production(): """Disables production environment for the bench.""" from bench.config.production_setup import disable_production disable_production(bench_path='.') + + +@click.command('src') +def bench_src(): + """Prints bench source folder path, which can be used as: cd `bench src` """ + import bench + print os.path.dirname(bench.__path__[0])