Create CLI template for Functest
[functest.git] / cli / cli_base.py
1 import click
2
3 from functest.cli.commands.cli_env import CliEnv
4 from functest.cli.commands.cli_testcase import CliTestcase
5 from functest.cli.commands.cli_tier import CliTier
6
7 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
8
9
10 @click.group(context_settings=CONTEXT_SETTINGS)
11 @click.version_option(version='opnfv colorado.0.1 ')
12 def cli():
13     pass
14
15 _env = CliEnv()
16 _testcase = CliTestcase()
17 _tier = CliTier()
18
19
20 @cli.group()
21 @click.pass_context
22 def env(ctx):
23     pass
24
25
26 @cli.group()
27 @click.pass_context
28 def testcase(ctx):
29     pass
30
31
32 @cli.group()
33 @click.pass_context
34 def tier(ctx):
35     pass
36
37
38 @env.command('show', help="write the help here")
39 def env_show():
40     _env.show()
41
42
43 @env.command('status', help="write the help here")
44 def env_status():
45     _env.status()
46
47
48 @env.command('getrc', help="write the help here")
49 def env_getrc():
50     _env.getrc()
51
52
53 @env.command('sourcerc', help="write the help here")
54 def env_sourcerc():
55     _env.sourcerc()
56
57
58 @env.command('setdefaults', help="write the help here")
59 def env_setdefaults():
60     _env.setdefaults()
61
62
63 @env.command('getdefaults', help="write the help here")
64 def env_getdefaults():
65     _env.getdefaults()
66
67
68 @env.command('clean', help="write the help here")
69 def env_clean():
70     _env.clean()
71
72
73 @testcase.command('list', help="write the help here")
74 def testcase_list():
75     _testcase.list()
76
77
78 @testcase.command('show', help="write the help here")
79 @click.argument('testname', type=click.STRING, required=True)
80 def testcase_show(testname):
81     _testcase.show(testname)
82
83
84 @testcase.command('run', help="write the help here")
85 @click.argument('testname', type=click.STRING, required=True)
86 def testcase_run(testname):
87     _testcase.run(testname)
88
89
90 @tier.command('list', help="write the help here")
91 def tier_list():
92     _tier.list()
93
94
95 @tier.command('show', help="write the help here")
96 @click.argument('tiername', type=click.STRING, required=True)
97 def tier_show(tiername):
98     _tier.show(tiername)
99
100
101 @tier.command('run', help="write the help here")
102 @click.argument('tiername', type=click.STRING, required=True)
103 def tier_run(tiername):
104     _tier.run(tiername)