blob: cf03ecf3d9ae3c1dd7e141223f54a841a65618fe (
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
40
41
42
43
44
45
46
47
48
49
|
import options
import config
import util
import colors
from verbs.sync import sync
from verbs.install import install
from verbs.update import update
def search():
pass
def remove():
pass
verbs = { v: globals()[v] for v in [
"search",
"update",
"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()
try:
(
verbs[verb] if verb in verbs else search
)(
args[1:] if len(args) > 1 else [], opts, conf
)
except KeyboardInterrupt:
print(colors.RESET + colors.CLEAR_LINE + colors.RED + "Action cancelled by user")
else:
options.print_usage()
return
print(colors.RESET + colors.CLEAR_LINE, end="")
|