completion

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2017-09-24 20:03:01 -04:00
parent ddb62472a3
commit 079b19053d
2 changed files with 10 additions and 5 deletions
+2 -4
View File
@@ -682,11 +682,9 @@ production environments for reproducible builds.
☤ Shell Completion
------------------
Set ``_PIPENV_COMPLETE`` and then source the output of the program.
For example, with ``fish``, put this in your
``~/.config/fish/completions/pipenv.fish``::
For fish:
eval (env _PIPENV_COMPLETE=source-fish pipenv)
eval (pipenv --completion)
Magic shell completions are now enabled!
+8 -1
View File
@@ -1498,7 +1498,14 @@ def cli(
sys.exit()
if completion:
os.environ['_PIPENV_COMPLETE'] = 'source-{0}'.format(os.environ['SHELL'].split(os.sep)[-1])
try:
os.environ['_PIPENV_COMPLETE'] = 'source-{0}'.format(os.environ['SHELL'].split(os.sep)[-1])
except KeyError:
click.echo(
'Please ensure that the {0} environment variable '
'is set.'.format(crayons.white('SHELL', bold=True)), err=True)
sys.exit(1)
c = delegator.run('pipenv')
click.echo(c.out)
sys.exit(0)