diff options
author | Aaron Walker <ka0ttic@gentoo.org> | 2005-04-12 12:28:58 +0000 |
---|---|---|
committer | Aaron Walker <ka0ttic@gentoo.org> | 2005-04-12 12:28:58 +0000 |
commit | b048755fb1f93be51026a273acec6ac94fbf8383 (patch) | |
tree | 721604e58f3020b9cda432dc7849eb8b4531b144 | |
parent | Add have() for local installations; bug 88326. (diff) | |
download | gentoo-bashcomp-b048755fb1f93be51026a273acec6ac94fbf8383.tar.gz gentoo-bashcomp-b048755fb1f93be51026a273acec6ac94fbf8383.tar.bz2 gentoo-bashcomp-b048755fb1f93be51026a273acec6ac94fbf8383.zip |
Added etcat completion.
svn path=/trunk/; revision=38
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | TODO | 46 | ||||
-rw-r--r-- | gentoo | 49 |
4 files changed, 59 insertions, 46 deletions
@@ -1,3 +1,12 @@ +2005-04-12 Aaron Walker <ka0ttic@gentoo.org> + + * Added etcat completion. + +2005-04-09 Aaron Walker <ka0ttic@gentoo.org> + + * Added have() so that it's possible for users to install the + completions "locally". + 2005-03-29 Aaron Walker <ka0ttic@gentoo.org> * Tagged 20050329 release. @@ -0,0 +1 @@ +Empty 'til release. @@ -7,52 +7,6 @@ # Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License, v2 or later -# -# etcat completion command -# -have etcat && { -_etcat() -{ - # -b </path/to/file> [category] - # belongs </path/to/file> [category] - # Searches for the package which a file belongs to with an option - # to restrict a search to a single or multiple category. Wildcards - # in the category name is accepted to speed up searching. - # (eg. etcat belongs /usr/lib/libmpeg.so "media-*") - # - # -c <package[-version]> - # changes <package[-version]> - # Outputs ChangeLog entry for the package and version specified. - # Uses the latest package version if none specified. - # - # -d <regex expression> - # depends <regex expression> - # Searches through portage for a dependency string satisfying that - # regular expression. - # - # -f <package[-version]> - # files <package[-version]> - # Lists all the files installed for this package. - # - # -s <package> - # size <package> - # Outputs the installed size of the package. - # - # -u <package[-version]> - # uses <package[-version]> - # Outputs the USE flags supported by this package and also their - # installed state and description. - # - # -v <package> - # versions <package> - # Output all the versions for packages that match the package name - # given with indication of whether the packages is stable, masked, - # unstable or installed. - -} -complete -F _etcat etcat -} - # epm completion command # have epm && { @@ -1430,4 +1430,53 @@ _webapp_config() complete -F _webapp_config webapp-config } +# +# etcat completion +# + +have etcat && { +_etcat() +{ + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-b belongs -c changes -d depends -f files -s size -u uses -v + versions" + + if [[ ${COMP_CWORD} -eq 1 ]] ; then + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 + fi + + case "${prev}" in + -b|belongs) + COMPREPLY=($(compgen -f -- ${cur})) + ;; + -c|changes) + _pkgname -A ${cur} + ;; + -d|depends) + # kinda hard to complete on a regex... + COMPREPLY=() + ;; + -f|files|-s|size|-u|uses|-v|versions) + _pkgname -I ${cur} + ;; + *) + local x b=0 + for x in ${COMP_WORDS[@]} ; do + [[ ${x} == "-b" || ${x} == "belongs" ]] && b=1 + done + + if [[ ${b} -eq 1 ]] ; then + local portdir=$(_portdir) + COMPREPLY=($(compgen -W "$(< ${portdir}/profiles/categories)" -- ${cur})) + fi + ;; + esac +} +complete -o filenames -F _etcat etcat +} + # vim: set ft=sh tw=80 sw=4 et : |