diff options
author | Shubham Saini <shubham6405@gmail.com> | 2018-12-11 10:01:23 +0000 |
---|---|---|
committer | Shubham Saini <shubham6405@gmail.com> | 2018-12-11 10:01:23 +0000 |
commit | 68df54d6629ec019142eb149dd037774f2d11e7c (patch) | |
tree | 345bc22d46b4e01a4ba8303b94278952a4ed2b9e /venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/help.py |
First commit
Diffstat (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/help.py')
-rw-r--r-- | venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/help.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/help.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/help.py new file mode 100644 index 0000000..f4a0e40 --- /dev/null +++ b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/help.py | |||
@@ -0,0 +1,36 @@ | |||
1 | from __future__ import absolute_import | ||
2 | |||
3 | from pip._internal.basecommand import SUCCESS, Command | ||
4 | from pip._internal.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 | ignore_require_venv = True | ||
14 | |||
15 | def run(self, options, args): | ||
16 | from pip._internal.commands import commands_dict, get_similar_commands | ||
17 | |||
18 | try: | ||
19 | # 'pip help' with no args is handled by pip.__init__.parseopt() | ||
20 | cmd_name = args[0] # the command we need help for | ||
21 | except IndexError: | ||
22 | return SUCCESS | ||
23 | |||
24 | if cmd_name not in commands_dict: | ||
25 | guess = get_similar_commands(cmd_name) | ||
26 | |||
27 | msg = ['unknown command "%s"' % cmd_name] | ||
28 | if guess: | ||
29 | msg.append('maybe you meant "%s"' % guess) | ||
30 | |||
31 | raise CommandError(' - '.join(msg)) | ||
32 | |||
33 | command = commands_dict[cmd_name]() | ||
34 | command.parser.print_help() | ||
35 | |||
36 | return SUCCESS | ||