From 22de7e33db433b71366ac878a0afaaab2445d930 Mon Sep 17 00:00:00 2001 From: shreyas Date: Tue, 5 Jul 2016 17:14:06 +0530 Subject: [PATCH] [Minor] Added '--version' option to bench command --- bench/commands/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bench/commands/__init__.py b/bench/commands/__init__.py index 60861e63..a1f7f450 100644 --- a/bench/commands/__init__.py +++ b/bench/commands/__init__.py @@ -1,8 +1,18 @@ import click +def print_bench_version(ctx, param, value): + """Prints current bench version""" + if not value or ctx.resilient_parsing: + return + + import bench + click.echo(bench.__version__) + ctx.exit() + @click.group() +@click.option('--version', is_flag=True, is_eager=True, callback=print_bench_version, expose_value=False) def bench_command(bench_path='.'): - "Bench manager for Frappe" + """Bench manager for Frappe""" import bench from bench.app import get_current_frappe_version from bench.utils import setup_logging