Path: blob/master/venv/Lib/site-packages/pip/_internal/commands/help.py
811 views
# The following comment should be removed at some point in the future.1# mypy: disallow-untyped-defs=False23from __future__ import absolute_import45from pip._internal.cli.base_command import Command6from pip._internal.cli.status_codes import SUCCESS7from pip._internal.exceptions import CommandError8910class HelpCommand(Command):11"""Show help for commands"""1213usage = """14%prog <command>"""15ignore_require_venv = True1617def run(self, options, args):18from pip._internal.commands import (19commands_dict, create_command, get_similar_commands,20)2122try:23# 'pip help' with no args is handled by pip.__init__.parseopt()24cmd_name = args[0] # the command we need help for25except IndexError:26return SUCCESS2728if cmd_name not in commands_dict:29guess = get_similar_commands(cmd_name)3031msg = ['unknown command "{}"'.format(cmd_name)]32if guess:33msg.append('maybe you meant "{}"'.format(guess))3435raise CommandError(' - '.join(msg))3637command = create_command(cmd_name)38command.parser.print_help()3940return SUCCESS414243