diff options
author | David Durrleman <dualmoo@gmail.com> | 2008-01-10 18:52:30 -0800 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2008-01-10 20:16:55 -0800 |
commit | 7a927042ff1dd40ebdc444f79876d4e99d4938c7 (patch) | |
tree | 0e49f348ddfe32c1166aeb08ae693bf6c4fbf5f2 | |
parent | fix up authors (diff) | |
download | zsh-completion-7a927042ff1dd40ebdc444f79876d4e99d4938c7.tar.gz zsh-completion-7a927042ff1dd40ebdc444f79876d4e99d4938c7.tar.bz2 zsh-completion-7a927042ff1dd40ebdc444f79876d4e99d4938c7.zip |
add completion for eselect
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | _eselect | 36 |
2 files changed, 37 insertions, 0 deletions
@@ -1,2 +1,3 @@ Baptiste Daroussin <baptiste.daroussin@gmail.com> +David Durrleman <dualmoo@gmail.com> oberyno <oberyno@gmail.com> diff --git a/_eselect b/_eselect new file mode 100644 index 0000000..faeba4e --- /dev/null +++ b/_eselect @@ -0,0 +1,36 @@ +#compdef eselect +#Author: David Durrleman +#Contributor : Baptiste Daroussin <baptiste.daroussin@gmail.com> + +_eselect () { + local globopts sedcmd modnames modopts + + globopts=( + "--no-colour[Disable coloured output]" \ + "--no-color[Disable coloured output]" + ) + modnames=(${${${(M)${(f)"$(eselect --no-color list-modules)"}## *}// */}// /}) + + if ((CURRENT == 2)); then + _arguments -s \ + "$globopts[@]" \ + "*:portage:_values 'eselect modules' \$modnames[@]" && return 0 + elif ((CURRENT == 3)); then + if [[ $words[2] == --no-colour || $words[2] == --no-color ]]; then + _arguments -s \ + "*:portage:_values 'eselect modules' \$modnames[@]" && return 0 + elif (( $modnames[(I)$words[2]] )); then + modopts=(${${${(M)${(f)"$(eselect --no-color $words[2] usage)"}## *}// */}// /}) + _arguments -s \ + "*:portage:_values 'eselect $words[2] options' \$modopts[@]" && return 0 + fi + elif ((CURRENT == 4)); then + if (( $modnames[(I)$words[3]] )); then + modopts=(${${${(M)${(f)"$(eselect --no-color $words[3] usage)"}## *}// */}// /}) + _arguments -s \ + "*:portage:_values 'eselect $words[3] options' \$modopts[@]" && return 0 + fi + fi +} + +_eselect "$@" |