X-Git-Url: https://projects.mako.cc/source/mw/blobdiff_plain/b21cc60a3bccf2ec4f477d07245df31b376ab316..bc37c596074d390ecfdd3eb746e548bccd0d87aa:/src/mw/cli.py diff --git a/src/mw/cli.py b/src/mw/cli.py index 7f5b4bc..7dc49c5 100644 --- a/src/mw/cli.py +++ b/src/mw/cli.py @@ -26,6 +26,7 @@ class CLI(object): def __init__(self): self.me = os.path.basename(sys.argv[0]) self.commands = {} + self.shortcuts = {} for name in mw.clicommands.__dict__: if name == 'CommandBase': continue @@ -34,13 +35,18 @@ class CLI(object): issubclass(clazz, mw.clicommands.CommandBase): cmd = clazz() self.commands[cmd.name] = cmd + self.shortcuts[cmd.name] = cmd.shortcuts def usage(self): print 'usage: %s [subcommand]' % self.me print for name in self.commands: cmd = self.commands[name] - print("\t%-14s %-25s" % (name, cmd.description)) + if len(cmd.shortcuts) > 0: + full = name + ' (' + ' '.join(cmd.shortcuts) + ')' + else: + full = name + print("\t%-14s %-25s" % (full, cmd.description)) print sys.exit(1)