summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-10 16:26:03 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-23 17:05:19 +0000
commitadb0fdbb232381df04303681b1474c501c2354af (patch)
tree9cbd0fff56dbf319e7d15df173ff8c3fafdba260
parent62b1fc94377f6ff303d51d18974bf088460412e4 (diff)
downloadpykolab-adb0fdbb232381df04303681b1474c501c2354af.tar.gz
Display help if an unknown command is specified (and do not bail out on --help).
Fix typo
-rw-r--r--pykolab/cli/commands.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index 7376234..d2f6d82 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -108,6 +108,10 @@ def list_commands(*args, **kw):
print "%-4s%-21s" % ('',__command.replace('_','-'))
def execute(cmd_name, *args, **kw):
+ if cmd_name == "":
+ execute("help")
+ sys.exit(0)
+
if not commands.has_key(cmd_name):
log.error(_("No such command."))
sys.exit(1)
@@ -190,7 +194,7 @@ def register(cmd_name, func, group=None, description=None, aliases=[]):
commands[alias] = {
'cmd_name': cmd_name,
'function': func,
- 'description': _("Alias for %s") % (cmd_name,replace('_','-'))
+ 'description': _("Alias for %s") % (cmd_name.replace('_','-'))
}
##