2012-11-10 05:17:58 +01:00
|
|
|
from pip.basecommand import Command, SUCCESS, ERROR
|
2011-08-02 19:41:31 +02:00
|
|
|
from pip.exceptions import CommandError
|
2009-11-20 19:20:52 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2009-11-20 19:20:52 +01:00
|
|
|
class HelpCommand(Command):
|
|
|
|
name = 'help'
|
|
|
|
usage = '%prog'
|
|
|
|
summary = 'Show available commands'
|
|
|
|
|
|
|
|
def run(self, options, args):
|
2012-11-10 05:17:58 +01:00
|
|
|
from pip.commands import commands
|
|
|
|
|
|
|
|
try:
|
|
|
|
# 'pip help' with no args is handled by pip.__init__.parseopt()
|
|
|
|
cmd_name = args[0] # the command we need help for
|
|
|
|
except:
|
2011-08-02 19:41:31 +02:00
|
|
|
return SUCCESS
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2012-11-10 05:17:58 +01:00
|
|
|
if cmd_name not in commands:
|
|
|
|
raise CommandError('unknown command "%s"' % cmd_name)
|
|
|
|
|
|
|
|
command = commands[cmd_name](self.main_parser) # instantiate
|
|
|
|
command.parser.print_help()
|
|
|
|
|
|
|
|
return SUCCESS
|