comparison venv/lib/python2.7/site-packages/pip/commands/help.py @ 0:d67268158946 draft

planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author bcclaywell
date Mon, 12 Oct 2015 17:43:33 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d67268158946
1 from __future__ import absolute_import
2
3 from pip.basecommand import Command, SUCCESS
4 from pip.exceptions import CommandError
5
6
7 class HelpCommand(Command):
8 """Show help for commands"""
9 name = 'help'
10 usage = """
11 %prog <command>"""
12 summary = 'Show help for commands.'
13
14 def run(self, options, args):
15 from pip.commands import commands_dict, get_similar_commands
16
17 try:
18 # 'pip help' with no args is handled by pip.__init__.parseopt()
19 cmd_name = args[0] # the command we need help for
20 except IndexError:
21 return SUCCESS
22
23 if cmd_name not in commands_dict:
24 guess = get_similar_commands(cmd_name)
25
26 msg = ['unknown command "%s"' % cmd_name]
27 if guess:
28 msg.append('maybe you meant "%s"' % guess)
29
30 raise CommandError(' - '.join(msg))
31
32 command = commands_dict[cmd_name]()
33 command.parser.print_help()
34
35 return SUCCESS