diff options
author | Raúl Benencia <rul@kalgan.cc> | 2012-10-10 18:34:21 -0300 |
---|---|---|
committer | Raúl Benencia <rul@kalgan.cc> | 2012-10-10 18:34:21 -0300 |
commit | 7ef52c68574b54333c44c5be739049deac3a28ec (patch) | |
tree | d86418475ecaf17087a40c90a26c31519b770e5c /lib/commandmanager.py | |
parent | b3fcf3b4e9dc49b0736e8ba1dfdab2e225999c6d (diff) |
Data loader
Diffstat (limited to 'lib/commandmanager.py')
-rw-r--r-- | lib/commandmanager.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/commandmanager.py b/lib/commandmanager.py new file mode 100644 index 0000000..3a06f99 --- /dev/null +++ b/lib/commandmanager.py @@ -0,0 +1,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() |