diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-08-08 11:16:10 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-08-08 11:16:10 +0200 |
commit | 3e5423f927d329a66d849258acfa22ef5f9f7332 (patch) | |
tree | 4ae1731689e57f25c61c4d35a140c1c41cadf90c /etc | |
parent | 4199a96f903a8f2e8961d52376e4f81f3d14575d (diff) |
etc/completions/_pkg: Only complete not-installed packages for add/install
Diffstat (limited to 'etc')
-rw-r--r-- | etc/completions/_pkg | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/etc/completions/_pkg b/etc/completions/_pkg index acd79d4..8a621a6 100644 --- a/etc/completions/_pkg +++ b/etc/completions/_pkg @@ -8,23 +8,28 @@ local arguments_action arguments_list arguments_listall local all installed -all=(pkg list-all) -installed=(pkg list) +all='pkg list-all' +installed='pkg list' +notinstalled='diff <(eval $installed) <(eval $all) | grep "^>" | cut -d " " -f 2' arguments_action=( '1:action:(add install changelog changeroot check delete remove info list list-all local-update log push remote-update status update upgrade)' ) arguments_list=( - '2:package:($($installed))' + '2:package:($(eval $installed))' ) arguments_listall=( - '2:package:($($all))' + '2:package:($(eval $all))' +) +arguments_notinstalled=( + '2:package:($(eval $notinstalled))' ) if [[ $CURRENT -ge 3 ]] { case ${words[2]} in changelog|check|delete|log|push|remove|status|upgrade) _arguments -s $arguments_list ;; - add|info|install) _arguments -s $arguments_listall ;; + info) _arguments -s $arguments_listall ;; + add|install) _arguments -s $arguments_notinstalled ;; esac } else { _arguments -s $arguments_action |