diff options
author | Tristan Heaven <nyhm@gentoo.org> | 2008-05-13 20:11:10 +0000 |
---|---|---|
committer | Tristan Heaven <nyhm@gentoo.org> | 2008-05-13 20:11:10 +0000 |
commit | 6468560c81b25d031f625b8d0c9fec9bba1d48b0 (patch) | |
tree | 02f1ca23c6cc0bb43d8d4a90f7f73689f90b62b9 /gentoo | |
parent | Added _complete_herd and _complete_dev for completing on herd/dev names respe... (diff) | |
download | gentoo-bashcomp-6468560c81b25d031f625b8d0c9fec9bba1d48b0.tar.gz gentoo-bashcomp-6468560c81b25d031f625b8d0c9fec9bba1d48b0.tar.bz2 gentoo-bashcomp-6468560c81b25d031f625b8d0c9fec9bba1d48b0.zip |
svn path=/trunk/; revision=60
Diffstat (limited to 'gentoo')
-rw-r--r-- | gentoo | 62 |
1 files changed, 9 insertions, 53 deletions
@@ -20,13 +20,15 @@ have() # _portdir() { - sed -n -e '/^PORTDIR=/ { s/^[^=]\+="\?\([^"]\+\|\S\+\).*/\1/p ; q }' \ - /etc/make.{conf,globals} 2>/dev/null + ( + source /etc/make.globals 2>/dev/null + source /etc/make.conf 2>/dev/null + echo ${PORTDIR} if [[ $1 == '-o' ]] ; then - sed -n -e '/^PORTDIR_OVERLAY=/ { s/^[^=]\+="\?\([^"]\+\|\S\+\).*/\1/p ; q }' \ - /etc/make.conf 2>/dev/null + echo ${PORTDIR_OVERLAY} fi + ) } # like _pkgname but completes on package names only (no category) @@ -286,46 +288,6 @@ _list_compgen() } # -# completes developer/herd names (requires herdstat) -# -have herdstat && { -_complete_herd() { - local herds_cache=/var/lib/herdstat/herds - # exists and generated today? - if [[ -f ${herds_cache} ]] && - [[ $(stat ${herds_cache} | sed -n -e 's/^Modify: \([[:digit:]]\+-[[:digit:]]\+-[[:digit:]]\+\).*$/\1/p') == "$(date +%F)" ]] - then - cat ${herds_cache} - else - local herds=$(herdstat -q all 2>/dev/null) - echo ${herds} > ${herds_cache} - echo ${herds} - fi -} - -_complete_dev() { - local devs devs_cache=/var/lib/herdstat/devs - - # exists and generated today? - if [[ -f ${devs_cache} ]] && - [[ $(stat ${devs_cache} | sed -n -e 's/^Modify: \([[:digit:]]\+-[[:digit:]]\+-[[:digit:]]\+\).*$/\1/p') == "$(date +%F)" ]] - then - devs=$(< ${devs_cache}) - else - devs=$(herdstat -dq all 2>/dev/null) - echo ${devs} > ${devs_cache} - fi - - if [[ ${1} == '-v' ]] ; then - local x - for x in ${devs} ; do echo ${x}@gentoo.org ; done - else - echo ${devs} - fi -} -} - -# # emerge completion command # have emerge && { @@ -1899,10 +1861,10 @@ complete -o filenames -F _epm epm } # -# metagen completion (requires herdstat) +# metagen completion # -have metagen && have herdstat && { +have metagen && { _metagen() { local cur prev opts COMPREPLY=() @@ -1916,13 +1878,7 @@ _metagen() { fi case "${prev}" in - -H) - COMPREPLY=($(compgen -W "$(_complete_herd) no-herd" -- ${cur})) - ;; - -e) - COMPREPLY=($(compgen -W "$(_complete_dev -v)" -- ${cur})) - ;; - -n|-d|-l|-o) + -H|-e|-n|-d|-l|-o) COMPREPLY=() ;; *) |