From b8dac99280d6fe3779d1dc943a16483a11e4051e Mon Sep 17 00:00:00 2001 From: zawz Date: Mon, 29 Jun 2020 16:39:05 +0200 Subject: [PATCH] limit remove completion to installed --- completion/zpkg.bash | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/completion/zpkg.bash b/completion/zpkg.bash index 14789b2..d3a805f 100644 --- a/completion/zpkg.bash +++ b/completion/zpkg.bash @@ -3,12 +3,15 @@ _zpkg_completion() { _cw1="deploy update update-database install remove fetch show deps info list list-all list-outdated list-removed" - _cw1_pkgw="install remove fetch show deps info" + _cw1_pkg_all="install fetch show deps info" + _cw1_pkg_installed="remove" _cw1_file="deploy" if [ "$COMP_CWORD" = "1" ] ; then - _compwords=$_cw1 - elif [ "$COMP_CWORD" -gt "1" ] && echo "$_cw1_pkgw" | grep -qw -- "${COMP_WORDS[1]}" ; then + _compwords="$_cw1" + elif [ "$COMP_CWORD" -gt "1" ] && echo "$_cw1_pkg_all" | grep -qw -- "${COMP_WORDS[1]}" ; then _compwords=$(zpkg list-all 2>/dev/null) + elif [ "$COMP_CWORD" -gt "1" ] && echo "$_cw1_pkg_installed" | grep -qw -- "${COMP_WORDS[1]}" ; then + _compwords=$(zpkg list 2>/dev/null) fi COMPREPLY=($(compgen -W "$_compwords" "${COMP_WORDS[$COMP_CWORD]}" 2>/dev/null)) }