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

from verbs.sync import sync
from verbs.install import install

def search():
    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