diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | TODO | 71 | ||||
-rw-r--r-- | gentoo | 54 |
3 files changed, 59 insertions, 70 deletions
@@ -1,5 +1,9 @@ ChangeLog for gentoo-bashcomp +2005-04-22 Aaron Walker <ka0ttic@gentoo.org> + + * Added euse completion. + 2005-04-19 Aaron Walker <ka0ttic@gentoo.org> * Added splat completion. @@ -1,72 +1,3 @@ -# -*- shell-script -*- -# -# Gentoo Linux command completion -- FEATURES (COMMANDS) TO BE ADDED. -# -# $Id: TODO,v 1.3 2004/06/03 01:04:41 zorder Exp $ -# -# Copyright 1999-2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License, v2 or later -# epm completion command -# -have epm && { -_epm() -{ +Todo List for gentoo-bashcomp -} -complete -F _epm epm -} - -# -# euse completion command -# -have euse && { -_euse() -{ -# DESCRIPTION -# euse is used to set(disable/enable) USE flags /etc/make.conf without having to edit the file directly. It is also used to -# get detail information about use flags like description, status of flags(enabled/disabled), type of flag(global/local) -# etc. It can also be queried for viewing the current use flag settings in /etc/make.conf, /etc/make.defaults and environ- -# ment. -# OPTIONS -# -c, --conf -# Print the USE flag setting in /etc/make.conf -# -d, --defaults -# Print the USE flag setting in /etc/make.profile/make.defaults -# -e, --env -# Print the USE flag setting in environment -# -E, --enable -# Enables USE flag(s) in make.conf. It accepts one or more USE flags space separted as parameters. Please read -# README for all the different cases it handles. -# -D, --disable -# Disables USE flag(s) in make.conf. Puts a '-' sign infront of the use flag and appends to USE setting of -# make.conf. It accepts one or more USE flags space separted as parameters. Please read README for all the different -# cases it handles. -# -i, --info -# Prints detail information about the USE flag(s). If no arguments are given then all the USE flag(global & local) -# information is printed. If one or more arguments are given(space separated) then information of only those flags -# are printed. -# The output is in the following format: -# alpha [-] [ ] [G] indicates that architecture ... -# moznocompose [+] [C] [L] [net-www/mozilla] : If you ... -# The column descriptions are: -# flag_name -# name of the use flag -# flag_status -# indicates whether the USE flag is enabled or disabled. - indicates disabled, + indicates enabled. -# flag_location -# indicates where the USE flag is enabled or disabled. C indicates make.conf, D indicates make.defaults, E -# indicates environment. -# flag_type -# indicates if the flag is global USE flag or a local USE flag.If it is local USE flag, then the description -# column begins with the package which it belongs to in square brackets. See moznocompose example above. -# description -# gives a short description of the USE flag -# -h, --help -# Show the help message listing all the available flags and a short description -# -v, --version -# Show the version information - -} -complete -F _euse euse -} @@ -1560,4 +1560,58 @@ _splat() { complete -o filenames -F _splat splat } +have euse && { +_euse() { + local cur prev opts sopts use portdir + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-h --help -v --version -i --info -a --active -E --enable -D --disable + -P --prune" + sopts="-g --global -l --local" + + if [[ ${cur} == -* ]] && [[ ${COMP_CWORD} -eq 1 ]] ; then + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 + fi + + case "${prev}" in + -h|--help|-v|--version) + COMPREPLY=() + ;; + -a|--active) + COMPREPLY=($(compgen -W "${sopts}" -- ${cur})) + ;; + -i|--info|-E|--enable|-D|--disable|-P|--prune) + portdir=$(_portdir) + use="$(sed -n -e 's/^\([^ ]\+\) - .*$/\1/p' ${portdir}/profiles/use.desc) \ + $(sed -n -e 's/^[^ ]\+:\([^ ]*\) - .*$/\1/p' ${portdir}/profiles/use.local.desc)" + COMPREPLY=($(compgen -W "${use} ${sopts}" -- ${cur})) + ;; + *) + local l=0 g=0 + + if [[ ${COMP_LINE} == *" "@(-l|--local)* ]] ; then + l=1 + elif [[ ${COMP_LINE} == *" "@(-g|--global)* ]] ; then + g=1 + fi + + if [[ ${COMP_LINE} == *" "@(-i|--info|-E|--enable|-D|--disable|-P|--prune)* ]] + then + portdir=$(_portdir) + + if [[ ${l} -eq 1 ]] ; then + use=$(sed -n -e 's/^[^ ]\+:\([^ ]*\) - .*$/\1/p' ${portdir}/profiles/use.local.desc) + elif [[ ${g} -eq 1 ]] ; then + use=$(sed -n -e 's/^\([^ ]\+\) - .*$/\1/p' ${portdir}/profiles/use.desc) + fi + + COMPREPLY=($(compgen -W "${use}" -- ${cur})) + fi + esac +} +complete -F _euse euse +} + # vim: set ft=sh tw=80 sw=4 et : |