mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
Allow 'help' command to print help for multiple commands at once
This commit is contained in:
parent
76546ec176
commit
2ed60de628
1 changed files with 12 additions and 14 deletions
|
@ -49,21 +49,19 @@ class Command(BaseCommand):
|
||||||
self._commands = self.console._commands
|
self._commands = self.console._commands
|
||||||
deferred = defer.succeed(True)
|
deferred = defer.succeed(True)
|
||||||
if args:
|
if args:
|
||||||
if len(args) > 1:
|
for arg in args:
|
||||||
self.console.write(usage)
|
try:
|
||||||
return deferred
|
cmd = self._commands[arg]
|
||||||
try:
|
except KeyError:
|
||||||
cmd = self._commands[args[0]]
|
self.console.write("{!error!}Unknown command %r" % args[0])
|
||||||
except KeyError:
|
continue
|
||||||
self.console.write("{!error!}Unknown command %r" % args[0])
|
try:
|
||||||
return deferred
|
parser = cmd.create_parser()
|
||||||
try:
|
self.console.write(parser.format_help())
|
||||||
parser = cmd.create_parser()
|
except AttributeError, e:
|
||||||
self.console.write(parser.format_help())
|
self.console.write(cmd.__doc__ or 'No help for this command')
|
||||||
except AttributeError, e:
|
self.console.write(" ")
|
||||||
self.console.write(cmd.__doc__ or 'No help for this command')
|
|
||||||
else:
|
else:
|
||||||
max_length = max( len(k) for k in self._commands)
|
|
||||||
self.console.set_batch_write(True)
|
self.console.set_batch_write(True)
|
||||||
for cmd in sorted(self._commands):
|
for cmd in sorted(self._commands):
|
||||||
self.console.write("{!info!}" + cmd + "{!input!} - " + self._commands[cmd].__doc__ or '')
|
self.console.write("{!info!}" + cmd + "{!input!} - " + self._commands[cmd].__doc__ or '')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue