summaryrefslogtreecommitdiffstats
path: root/pykolab/cli/commands.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-13 17:04:38 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-13 17:04:38 +0100
commit6b49689c5b655f4d262a1cd27956ab56ab06225f (patch)
tree2b27e6a172445c5fe1b56598f8a153d6b248c176 /pykolab/cli/commands.py
parentbdaefc9e82e48f683c0a4a6f527c327cbc18ba65 (diff)
downloadpykolab-6b49689c5b655f4d262a1cd27956ab56ab06225f.tar.gz
Enable use of alias commands with cli options
Diffstat (limited to 'pykolab/cli/commands.py')
-rw-r--r--pykolab/cli/commands.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index 7236b0b..9ea8da9 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -121,10 +121,11 @@ def execute(cmd_name, *args, **kw):
pass
else:
+ command_name = commands[cmd_name]['cmd_name']
try:
- exec("from cmd_%s import cli_options as %s_cli_options" % (cmd_name,cmd_name))
- exec("%s_cli_options()" % (cmd_name))
- except ImportError, e:
+ exec("from cmd_%s import cli_options as %s_cli_options" % (command_name,command_name))
+ exec("%s_cli_options()" % (command_name))
+ except ImportError, errmsg:
pass
conf.finalize_conf()
@@ -179,6 +180,7 @@ def register(cmd_name, func, group=None, description=None, aliases=[]):
for alias in aliases:
commands[alias] = {
+ 'cmd_name': cmd_name,
'function': func,
'description': _("Alias for %s") % (cmd_name)
}
@@ -189,4 +191,4 @@ def register(cmd_name, func, group=None, description=None, aliases=[]):
def not_yet_implemented(*args, **kw):
print _("Not yet implemented")
- sys.exit(1) \ No newline at end of file
+ sys.exit(1)