diff options
author | Shubham Saini <shubham6405@gmail.com> | 2019-08-05 08:32:33 +0000 |
---|---|---|
committer | Shubham Saini <shubham6405@gmail.com> | 2019-08-05 08:32:33 +0000 |
commit | 227b2d30a8675b44918f9d9ca89b24144a938215 (patch) | |
tree | 9f8e6a28724514b6fdf463a9ab2067a7ef309b72 /venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/completion.py | |
parent | 842a8cfbbbdb1f92889d892e4859dbd5d40c5be8 (diff) |
removing venv files
Diffstat (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/completion.py')
-rw-r--r-- | venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/completion.py | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/completion.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/completion.py deleted file mode 100644 index 8da1e83..0000000 --- a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/completion.py +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | from __future__ import absolute_import | ||
2 | |||
3 | import sys | ||
4 | import textwrap | ||
5 | |||
6 | from pip._internal.basecommand import Command | ||
7 | from pip._internal.utils.misc import get_prog | ||
8 | |||
9 | BASE_COMPLETION = """ | ||
10 | # pip %(shell)s completion start%(script)s# pip %(shell)s completion end | ||
11 | """ | ||
12 | |||
13 | COMPLETION_SCRIPTS = { | ||
14 | 'bash': """ | ||
15 | _pip_completion() | ||
16 | { | ||
17 | COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \\ | ||
18 | COMP_CWORD=$COMP_CWORD \\ | ||
19 | PIP_AUTO_COMPLETE=1 $1 ) ) | ||
20 | } | ||
21 | complete -o default -F _pip_completion %(prog)s | ||
22 | """, | ||
23 | 'zsh': """ | ||
24 | function _pip_completion { | ||
25 | local words cword | ||
26 | read -Ac words | ||
27 | read -cn cword | ||
28 | reply=( $( COMP_WORDS="$words[*]" \\ | ||
29 | COMP_CWORD=$(( cword-1 )) \\ | ||
30 | PIP_AUTO_COMPLETE=1 $words[1] ) ) | ||
31 | } | ||
32 | compctl -K _pip_completion %(prog)s | ||
33 | """, | ||
34 | 'fish': """ | ||
35 | function __fish_complete_pip | ||
36 | set -lx COMP_WORDS (commandline -o) "" | ||
37 | set -lx COMP_CWORD ( \\ | ||
38 | math (contains -i -- (commandline -t) $COMP_WORDS)-1 \\ | ||
39 | ) | ||
40 | set -lx PIP_AUTO_COMPLETE 1 | ||
41 | string split \\ -- (eval $COMP_WORDS[1]) | ||
42 | end | ||
43 | complete -fa "(__fish_complete_pip)" -c %(prog)s | ||
44 | """, | ||
45 | } | ||
46 | |||
47 | |||
48 | class CompletionCommand(Command): | ||
49 | """A helper command to be used for command completion.""" | ||
50 | name = 'completion' | ||
51 | summary = 'A helper command used for command completion.' | ||
52 | ignore_require_venv = True | ||
53 | |||
54 | def __init__(self, *args, **kw): | ||
55 | super(CompletionCommand, self).__init__(*args, **kw) | ||
56 | |||
57 | cmd_opts = self.cmd_opts | ||
58 | |||
59 | cmd_opts.add_option( | ||
60 | '--bash', '-b', | ||
61 | action='store_const', | ||
62 | const='bash', | ||
63 | dest='shell', | ||
64 | help='Emit completion code for bash') | ||
65 | cmd_opts.add_option( | ||
66 | '--zsh', '-z', | ||
67 | action='store_const', | ||
68 | const='zsh', | ||
69 | dest='shell', | ||
70 | help='Emit completion code for zsh') | ||
71 | cmd_opts.add_option( | ||
72 | '--fish', '-f', | ||
73 | action='store_const', | ||
74 | const='fish', | ||
75 | dest='shell', | ||
76 | help='Emit completion code for fish') | ||
77 | |||
78 | self.parser.insert_option_group(0, cmd_opts) | ||
79 | |||
80 | def run(self, options, args): | ||
81 | """Prints the completion code of the given shell""" | ||
82 | shells = COMPLETION_SCRIPTS.keys() | ||
83 | shell_options = ['--' + shell for shell in sorted(shells)] | ||
84 | if options.shell in shells: | ||
85 | script = textwrap.dedent( | ||
86 | COMPLETION_SCRIPTS.get(options.shell, '') % { | ||
87 | 'prog': get_prog(), | ||
88 | } | ||
89 | ) | ||
90 | print(BASE_COMPLETION % {'script': script, 'shell': options.shell}) | ||
91 | else: | ||
92 | sys.stderr.write( | ||
93 | 'ERROR: You must pass %s\n' % ' or '.join(shell_options) | ||
94 | ) | ||