summaryrefslogtreecommitdiff
path: root/src/xi.py
blob: 0b11c56e5fa274c1796a1d54d1e8cffe7bb8e397 (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

from verbs.sync import sync

def search():
    pass
def install():
    pass
def remove():
    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 [], opts, conf
        )
    else:
        options.print_usage()
        return