summaryrefslogtreecommitdiff
path: root/src/xi.py
blob: 90930c248a13f60aaba14e49eb3d405db9eb6d95 (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
import config

def search():
    pass
def install():
    pass
def remove():
    pass
def sync():
    pass

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

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

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

    conf = config.parse_file(opts["c"])
    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