From 856506fb68c6f382a4a08a52f2fb262ebc226c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20Sowi=C5=84ski?= Date: Sat, 21 Apr 2012 19:47:00 +0200 Subject: [PATCH 3/9] Fix completion for `equery belongs` 1. Remove -c and --category options as they are not present in `equery belongs --help` output. 2. Make code indentation more readable. 3. "Only complete if the previous entry on the command line is not a file name." now works properly also with options. --HG-- extra : source : 9f755f92ba552dcd20d20e473ff6cf5848c27e9e --- gentoo | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-) diff --git a/gentoo b/gentoo index 2ae86f9..e93fd78 100644 --- a/gentoo +++ b/gentoo @@ -1177,31 +1177,17 @@ _equery() b?(elongs)) # Only complete if the previous entry on the command line is not # a file name. - if \ - [[ \ - ${prev} == ${mode} || \ - ${prev:0:1} == "-" || \ - ${COMP_WORDS[COMP_CWORD-2]} == "-c" || \ - ${COMP_WORDS[COMP_CWORD-2]} == "--category" \ - ]] && \ - [[ \ - ${prev} != "-c" && \ - ${prev} != "--category" \ - ]] - then - case $cur in - -*) - COMPREPLY=($(compgen -W "-h --help -f --full-regex -e - --early-out -n --name-only" -- $cur)) - ;; - *) - COMPREPLY=($(compgen -f -- $cur) \ - $(compgen -d -S '/' -- $cur)) - ;; - esac - # Are we completing a category? - elif [[ ${prev} == "-c" || ${prev} == "--category" ]]; then - COMPREPLY=($(builtin cd ${portdir}/metadata/cache; compgen -W "$(compgen -G '*')" -- $cur)) + if [[ ${prev} == ${mode} || ${prev:0:1} == "-" ]]; then + case $cur in + -*) + COMPREPLY=($(compgen -W "-h --help -f --full-regex -e + --early-out -n --name-only" -- $cur)) + ;; + *) + COMPREPLY=($(compgen -f -- $cur) \ + $(compgen -d -S '/' -- $cur)) + ;; + esac fi ;; u?(ses)) -- 1.7.3.4