-
Notifications
You must be signed in to change notification settings - Fork 1
/
entries.py
39 lines (34 loc) · 932 Bytes
/
entries.py
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
from . import util
from . import checkout
from . import export
from . import reset
from . import ids
def no_impl(*arglist, **argmap):
raise util.C4JInsideError("The method is not implemented")
__entry_map = {
# Begin
# Register commands with method implementation there or use function register_command()
"checkout" : checkout.CHECKOUT,
"export" : export.EXPORT,
"reset" : reset.RESET,
"pids" : ids.PIDS,
"bids" : ids.BIDS,
"cids" : ids.CIDS,
"ver" : no_impl,
"info" : no_impl
# End
}
def invoke(name, args):
if not name in __entry_map:
util.printc('Unknown command {}'.format(name))
return
__entry_map[name](args)
def register_command(name, impl):
__entry_map[name] = impl
def remove_command(name):
__entry_map.pop(name)
def __names():
for i in __entry_map:
yield i
def names():
return list(__names())