summaryrefslogtreecommitdiff
path: root/lib/commandmanager.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/commandmanager.py')
-rw-r--r--lib/commandmanager.py37
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()
nihil fit ex nihilo