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
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)
dest='use_auth', help='force authentication '
'even if not required')
self.parser.add_option_group(global_options)
+ self.shortcuts = []
def main(self):
(self.options, self.args) = self.parser.parse_args()
def __init__(self):
usage = '%prog fetch [options] PAGENAME ...'
CommandBase.__init__(self, 'fetch', 'fetch remote pages', usage)
+ self.shortcuts.append('ft')
def _do_command(self):
self._die_if_no_init()