diff options
author | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2016-11-03 08:24:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-11-03 08:24:59 +0000 |
commit | e831e0b5e918200e98e8abe8d10a46c7873e6128 (patch) | |
tree | 38a94d9121927d2f8e27ac4101b03095437a2999 /cli | |
parent | e31bccefc4e71f5d88e6a0017229d02979bae930 (diff) | |
parent | 6da9724b36e7e4dc027ae2670cad4ae29c66fcb0 (diff) |
Merge "Cli list option for suite"
Diffstat (limited to 'cli')
-rw-r--r-- | cli/commands/suite.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/cli/commands/suite.py b/cli/commands/suite.py new file mode 100644 index 00000000..757f11a1 --- /dev/null +++ b/cli/commands/suite.py @@ -0,0 +1,52 @@ +############################################################################## +# Copyright (c) 2016 ZTE Corp and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +from prettytable import PrettyTable +import os +import click + + +class Suite: + + def __init__(self): + self.path = os.path.join(os.path.dirname(__file__), '..', '..', 'benchmarks/suite') + + def list(self): + table = PrettyTable(["Name"]) + table.align = 'l' + suites = os.listdir(self.path) + for suite in suites: + table.add_row([suite]) + click.echo(table) + + def run(self): + print("Run a suite") + + +@click.group() +def cli(): + pass + + +@cli.group() +@click.pass_context +def suite(ctx): + pass + +_suite = Suite() + + +@suite.command("list", help="Lists all the available suites") +def list(): + _suite.list() + + +@suite.command("run", help="Execute one complete suite") +def execute(): + _suite.run() |