From 625137464f61ff611ab6fb644ba5d72bb0e6d971 Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Wed, 26 Aug 2009 16:18:25 -0300 Subject: [PATCH] fixed bug in help command (thanks slav0nic for reporting) --- scrapy/command/commands/help.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scrapy/command/commands/help.py b/scrapy/command/commands/help.py index 5cecbc75d..915a22041 100644 --- a/scrapy/command/commands/help.py +++ b/scrapy/command/commands/help.py @@ -1,3 +1,5 @@ +import textwrap + from scrapy.command import ScrapyCommand, cmdline class Command(ScrapyCommand): @@ -14,16 +16,25 @@ class Command(ScrapyCommand): if not args: return False - commands = cmdline.builtin_commands_dict() - commands.update(cmdline.custom_commands_dict()) + commands = cmdline.get_commands_dict() cmdname = args[0] if cmdname in commands: cmd = commands[cmdname] help = getattr(cmd, 'help', None) or getattr(cmd, 'long_desc', None) - print "%s: %s" % (cmdname, cmd.short_desc()) + title = "%s command" % cmdname + print title + print "-" * len(title) + print + print cmd.short_desc() + print print "usage: %s %s" % (cmdname, cmd.syntax()) print - print help() + print "\n".join(textwrap.wrap(help())) + print + print "For a list of supported arguments use:" + print + print " scrapy-ctl.py %s -h" % cmdname + print else: print "Unknown command: %s" % cmdname