comparison planemo/lib/python3.7/site-packages/pip/_internal/commands/help.py @ 1:56ad4e20f292 draft

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