summaryrefslogtreecommitdiffstats
path: root/pykolab/cli
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-30 14:50:55 +0200
commitaad5fa666715d8e68ea3a110a0e5d6a44a11beb1 (patch)
tree9d17ddd7b35397129930727b0d0c905a281178b2 /pykolab/cli
parentaa3695ace4ad5953c644017461c5b65b9d7d7dde (diff)
downloadpykolab-aad5fa666715d8e68ea3a110a0e5d6a44a11beb1.tar.gz
Enable use of alias commands with cli options
Diffstat (limited to 'pykolab/cli')
-rw-r--r--pykolab/cli/commands.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index 155a110..86f0a33 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -125,10 +125,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()
@@ -183,6 +184,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)
}