@@ -31,6 +31,25 @@ $ source /path/to/venv/bin/activate
3131** Note** : all of the remaining example commands assume you've activated your
3232project's virtual environment.
3333
34+ ## Shell completion
35+
36+ ` pip-compile ` and ` pip-sync ` support shell completion through Click.
37+ For example, to install completion scripts for zsh in a user-level
38+ completion directory:
39+
40+ ``` console
41+ $ mkdir -p " ${XDG_DATA_HOME:- $HOME / .local/ share} /zsh/site-functions"
42+ $ _PIP_COMPILE_COMPLETE=zsh_source pip-compile \
43+ > "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions/_pip-compile"
44+ $ _PIP_SYNC_COMPLETE=zsh_source pip-sync \
45+ > "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions/_pip-sync"
46+ ```
47+
48+ Make sure that directory is present in your zsh ` fpath ` . For Bash or Fish,
49+ use ` bash_source ` or ` fish_source ` instead, and write the generated script to
50+ the completion directory for that shell. See
51+ [ Click's shell completion support] [ click-shell-completion ] for more details.
52+
3453## Example usage for ` pip-compile `
3554
3655The ` pip-compile ` command lets you compile a ` requirements.txt ` file from
@@ -680,6 +699,7 @@ note that it is deprecated and will be removed in a future release.
680699[buildstatus-gha-image] : https://github.com/jazzband/pip-tools/workflows/CI/badge.svg
681700[codecov] : https://codecov.io/gh/jazzband/pip-tools
682701[codecov-image] : https://codecov.io/gh/jazzband/pip-tools/branch/main/graph/badge.svg
702+ [click-shell-completion] : https://click.palletsprojects.com/shell-completion/
683703[Matrix Room Badge] : https://img.shields.io/matrix/pip-tools:matrix.org?label=Discuss%20on%20Matrix%20at%20%23pip-tools%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat
684704[Matrix Room] : https://matrix.to/#/%23pip-tools:matrix.org
685705[Matrix Space Badge] : https://img.shields.io/matrix/jazzband:matrix.org?label=Discuss%20on%20Matrix%20at%20%23jazzband%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat
0 commit comments