0328578f3ce66770d828c983635a61db9ac37ac7
[bottlenecks.git] / cli / bottlenecks_cli.py
1 #!/usr/bin/env python
2 ##############################################################################
3 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 import click
12
13 from command_group.testcase import Testcase
14
15 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
16
17
18 @click.group(context_settings=CONTEXT_SETTINGS)
19 @click.version_option(version='0.1')
20 @click.pass_context
21 def main(ctx):
22     """cli for bottlenecks project
23
24        commands:
25        bottlenecks testcase run <testcase>
26     """
27     pass
28
29 _testcase = Testcase()
30
31 @main.group()
32 @click.pass_context
33 def testcase(ctx):
34     """testcase cli group for bottlenecks project"""
35     pass
36
37 @testcase.command('run', help="To execute a test case.")
38 @click.argument('testname', type=click.STRING, required=True)
39 @click.option('-n', '--noclean', is_flag=True, default=False,
40               help='Openstack resources created by the test'
41               'will not be cleaned after the testcase execution.')
42 def testcase_run(testname, noclean):
43     _testcase.run(testname, noclean)