blob: 3a06f990448976b9897b3cef43ffa3f042054363 (
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
|
from lib.exceptions import CmdNotFoundException
class Command:
def __init__(self):
pass
def execute(self, loader, params):
pass
def usage(self, cmd_name):
return cmd_name
class AdminCommand(Command):
pass
class NetworkCommand(Command):
pass
class DomainCommand(Command):
pass
class CommandManager:
def __init__(self):
self.cmds = {
'admin' : AdminCommand(),
'network': NetworkCommand(),
'domain' : DomainCommand(),
}
def find(self, cmd):
if cmd in self.cmds:
return self.cmds[cmd]
else:
raise CmdNotFoundException(cmd + 'is not a valid command.')
def commands(self):
return self.cmds.keys()
|