aboutsummaryrefslogtreecommitdiffstats
path: root/qtip/cli/commands/cmd_metric.py
diff options
context:
space:
mode:
authorTaseer <taseer94@gmail.com>2017-06-02 14:23:55 +0500
committerTaseer <taseer94@gmail.com>2017-06-02 19:41:05 +0500
commit30f07d0e8e2d82e613155e218d92f126ad1316bf (patch)
tree0daa3445e6bd359ba6fa0f7c89ff53bf87d062d7 /qtip/cli/commands/cmd_metric.py
parentaa27f390c9ad6817d2682c4f59594f43c69d614f (diff)
Refactor Cli
- Remove reduntant contexts - Remove verbose option - Use builtin help and version options Change-Id: Ifb66009b5f9ab95428ce87c90f739b5221ccdd6f Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
Diffstat (limited to 'qtip/cli/commands/cmd_metric.py')
-rw-r--r--qtip/cli/commands/cmd_metric.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/qtip/cli/commands/cmd_metric.py b/qtip/cli/commands/cmd_metric.py
index 1741fb48..0a385898 100644
--- a/qtip/cli/commands/cmd_metric.py
+++ b/qtip/cli/commands/cmd_metric.py
@@ -14,22 +14,17 @@ import os
from qtip.base.error import InvalidContentError
from qtip.base.error import NotFoundError
from qtip.cli import utils
-from qtip.cli.entry import Context
from qtip.loader.metric import MetricSpec
-pass_context = click.make_pass_decorator(Context, ensure=False)
-
@click.group()
-@pass_context
-def cli(ctx):
+def cli():
''' Performance Metrics Group '''
pass
@cli.command('list', help='List all the Metric Groups')
-@pass_context
-def cmd_list(ctx):
+def cmd_list():
metrics = MetricSpec.list_all()
table = utils.table('Metrics', metrics)
click.echo(table)
@@ -37,8 +32,7 @@ def cmd_list(ctx):
@cli.command('show', help='View details of a Metric')
@click.argument('name')
-@pass_context
-def show(ctx, name):
+def show(name):
try:
metric = MetricSpec('{}.yaml'.format(name))
except NotFoundError as nf:
@@ -54,8 +48,7 @@ def show(ctx, name):
@cli.command('run', help='Run performance test')
@click.argument('name')
@click.option('-p', '--path', help='Path to store results')
-@pass_context
-def run(ctx, name, path):
+def run(name, path):
runner_path = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir,
'runner/runner.py')
os.system('python {0} -b {1} -d {2}'.format(runner_path, name, path))