summaryrefslogtreecommitdiff
path: root/src/xi.py
blob: 2449328eab1e964c05abc81dbc6bed31282076f1 (plain)
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
import options

def search(terms):
    print(f"searching for {terms}")
    pass

def install(terms):
    print(f"installing for {terms}")
    pass

def remove(terms):
    print(f"removing for {terms}")
    pass

verbs = { v: globals()[v] for v in [
                "search",
                "install"
                "remove"
            ]
        }

def main():
    opts = options.parse_args()
    args = opts["args"]

    if opts["h"]:
        options.print_usage()
        return

    if len(args) > 0:
        verb = args[0].lower()
        (
            verbs[verb] if verb in verbs else search
        )(
            args[1:] if len(args) > 1 else []
        )
    else:
        options.print_usage()
        return