-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from gtalarico/autocomplete
Added autocomplete helper, docs and gifs - Issue #10
- Loading branch information
Showing
6 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
.. highlight:: console | ||
|
||
================ | ||
Shell Completion | ||
================ | ||
|
||
Pipes includes a helper ``--_completion`` flag which can be | ||
used by terminals to provide autocomplete options. | ||
Below are instructions for setting up autocompletion | ||
for Bash, Zsh, and Fish. | ||
|
||
If you have ideas for improving these please share them with use | ||
over at the `Pipes repo <http://www.github.com/gtalarico/pipenv-pipes>`_ | ||
|
||
.. warning:: | ||
|
||
Pipes cannot activate an pipenv shell when one is already active, | ||
thefore the autocompletion helper does not run either. | ||
Make sure you are not inside a Pipenv Shell when trying to use | ||
the autocomplete helper. | ||
|
||
---------------------------- | ||
|
||
Fish | ||
---- | ||
|
||
Add a new file ``pipes.fish`` to your Fish config folder | ||
(eg. ``~/.config/fish/completions/pipes.fish``). | ||
|
||
.. code:: console | ||
complete --command pipes --arguments '(pipes --_completion (commandline -cp))' --no-files | ||
.. image:: static/gif-autocomplete-fish.gif | ||
|
||
|
||
---------------------------- | ||
|
||
Bash + Zsh | ||
----------- | ||
|
||
Original code kindly provided by `jonatasbaldin <https://github.com/jonatasbaldin>`_ | ||
`here <https://github.com/gtalarico/pipenv-pipes/issues/10>`_ | ||
|
||
Add the code below to your `.bashrc`: | ||
|
||
.. code:: console | ||
# .bashrc | ||
export BASE_SHELL=$(basename $SHELL) | ||
if [[ "$BASE_SHELL" == "zsh" ]] ; then | ||
autoload bashcompinit && bashcompinit | ||
fi | ||
_pipenv-pipes_completions() { | ||
COMPREPLY=($(compgen -W "$(pipes --_completion)" -- "${COMP_WORDS[1]}")) | ||
} | ||
complete -F _pipenv-pipes_completions pipes | ||
.. image:: static/gif-autocomplete-bash.gif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ Pipenv Pipes Documentation | |
readme | ||
installation | ||
usage | ||
completions | ||
contributing | ||
history | ||
|
||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters