Skip to content

Commit

Permalink
feat(pipenv): add fallback 3rd party completion loader (#1020)
Browse files Browse the repository at this point in the history
* feat(pipenv): add fallback 3rd party completion loader

https://pipenv.pypa.io/en/latest/shell/#shell-completion

Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
  • Loading branch information
scop and akinomyoga authored Aug 28, 2023
1 parent e2e11e6 commit 6ecf5bd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions completions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ bashcomp_DATA = 2to3 \
pidof \
pine \
ping \
_pipenv \
pkg-config \
pkg-get \
pkg_delete \
Expand Down
15 changes: 15 additions & 0 deletions completions/_pipenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 3rd party completion loader for commands emitting -*- shell-script -*-
# their completion using "_${cmdname^^}_COMPLETE=bash_source $cmd".
# This pattern is used by programs built with https://click.palletsprojects.com
#
# This serves as a fallback in case the completion is not installed otherwise.

eval -- "$(
# shellcheck disable=SC2154
ucname="${cmdname^^}"
ucname=${ucname//-/_}
export "_${ucname}_COMPLETE=bash_source"
"$1" 2>/dev/null
)"

# ex: filetype=sh
1 change: 1 addition & 0 deletions test/fallback/completions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ EXTRA_DIST = \
newgrp \
nmcli \
nox \
pipenv \
renice \
repomanage \
reptyr \
Expand Down
1 change: 1 addition & 0 deletions test/fallback/completions/pipenv

0 comments on commit 6ecf5bd

Please sign in to comment.