aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/hrc/cli.py
blob: 55758bceb4f3b6e7be38b1d8de534eb9d91c8d6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import argparse


class Cli(object):
    parser = argparse.ArgumentParser(description="水系核心终端")

    def __init__(self):
        self.parser.add_argument(
            "-i",
            "--install",
            dest="command",
            help="安装规则包",
            action="store_const",
            const="install_package",
        )
        self.parser.add_argument(
            "-T",
            "--template",
            dest="command",
            help="选择模板快速创建规则包实例",
            action="store_const",
            const="build_template",
        )
        self.parser.add_argument(
            "-S",
            "--search",
            dest="command",
            help="在指定镜像源查找规则包",
            action="store_const",
            const="search_package",
        )
        self.parser.add_argument(
            "-c",
            "--config",
            dest="command",
            help="配置管理",
            action="store_const",
            const="config",
        )
        self.args = self.parser.parse_args()

    def get_args(self):
        return self.args

    def get_help(self):
        return self.parser.format_help()