diff --git a/completions/Makefile.am b/completions/Makefile.am index ddf85f9dd35..4981257b379 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -316,6 +316,7 @@ bashcomp_DATA = 2to3 \ pidof \ pine \ ping \ + _pipenv \ pkg-config \ pkg-get \ pkg_delete \ diff --git a/completions/_pipenv b/completions/_pipenv new file mode 100644 index 00000000000..e6d2df6aa52 --- /dev/null +++ b/completions/_pipenv @@ -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 diff --git a/test/fallback/completions/Makefile.am b/test/fallback/completions/Makefile.am index 9643bf118a0..ef1af3fcc0c 100644 --- a/test/fallback/completions/Makefile.am +++ b/test/fallback/completions/Makefile.am @@ -24,6 +24,7 @@ EXTRA_DIST = \ newgrp \ nmcli \ nox \ + pipenv \ renice \ repomanage \ reptyr \ diff --git a/test/fallback/completions/pipenv b/test/fallback/completions/pipenv new file mode 120000 index 00000000000..faa7ea36980 --- /dev/null +++ b/test/fallback/completions/pipenv @@ -0,0 +1 @@ +../../../completions/_pipenv \ No newline at end of file