diff options
author | 2012-04-30 16:44:36 +0200 | |
---|---|---|
committer | 2012-05-06 15:37:10 -0500 | |
commit | b7449cc04fbeed2b786ce7478e79e1e87cc5d8b7 (patch) | |
tree | 6fc684c659a72180083cb2ad580f2684e59fb3dc | |
parent | Check options in `equery list` further than just in $prev (diff) | |
download | gentoo-bashcomp-b7449cc04fbeed2b786ce7478e79e1e87cc5d8b7.tar.gz gentoo-bashcomp-b7449cc04fbeed2b786ce7478e79e1e87cc5d8b7.tar.bz2 gentoo-bashcomp-b7449cc04fbeed2b786ce7478e79e1e87cc5d8b7.zip |
Added a completion function for epkginfo.
epkginfo is just a shortcut for equery meta,
so I reused the code for that.
-rw-r--r-- | gentoo | 49 |
1 files changed, 41 insertions, 8 deletions
@@ -1082,6 +1082,24 @@ complete -F _browserconfig browser-config } # +# Helper routine for the subcommand 'meta' of 'equery' +# (Used two times, by _equery and _epkginfo, therefore in an extra function) +# +_equery_meta() +{ + local cur="$1" + + case $cur in + -*) + COMPREPLY=($(compgen -W "--help -h --description -d --herd -H --keywords -k --maintainer -m --useflags -u --upstream -U --xml -x" -- $cur)) + ;; + *) + _pkgname -A $cur + ;; + esac +} + +# # Bash completion for the Gentoo 'equery' command # have equery && { @@ -1296,14 +1314,7 @@ _equery() # Only complete if the previous entry on the command line is not # a package name. if [[ ${prev} == ${mode} || ${prev:0:1} == "-" ]]; then - case $cur in - -*) - COMPREPLY=($(compgen -W "--help -h --description -d --herd -H --keywords -k --maintainer -m --useflags -u --upstream -U --xml -x" -- $cur)) - ;; - *) - _pkgname -A $cur - ;; - esac + _equery_meta $cur fi ;; k|check) @@ -1364,6 +1375,28 @@ complete -F _equery equery } # +# epkginfo completion +# + +have epkginfo && { +_epkginfo() +{ + local cur prev + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + # Only complete if the previous entry on the command line is not + # a package name. + if [[ ${COMP_CWORD} -eq 1 || ${prev:0:1} == "-" ]]; then + _equery_meta $cur + fi + + return 0 +} +complete -F _epkginfo epkginfo +} + +# # ekeyword completion # |