summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Olexa <darkside@gentoo.org>2009-05-05 03:34:35 +0000
committerJeremy Olexa <darkside@gentoo.org>2009-05-05 03:34:35 +0000
commit20ee63409ae9f8e5a45c202e2c01b41a1700f54f (patch)
tree4943d588c2cf25f2417b4c9317c31acef5c2e990
parentUpdate copywrite years to current (diff)
downloadgentoo-bashcomp-20ee63409ae9f8e5a45c202e2c01b41a1700f54f.tar.gz
gentoo-bashcomp-20ee63409ae9f8e5a45c202e2c01b41a1700f54f.tar.bz2
gentoo-bashcomp-20ee63409ae9f8e5a45c202e2c01b41a1700f54f.zip
Add layman completions by Peter Link Sterk <link@penguindevelopment.org> in bug 224273
svn path=/trunk/; revision=84
-rw-r--r--layman75
1 files changed, 75 insertions, 0 deletions
diff --git a/layman b/layman
new file mode 100644
index 0000000..c3457db
--- /dev/null
+++ b/layman
@@ -0,0 +1,75 @@
+# Gentoo Linux Layman Command Completion
+#
+# $Id$
+#
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+#
+# Originally licensed as 'public-domain'
+# Originally written by: Peter "Link" Sterk <link@penguindevelopment.org>
+
+
+have layman && {
+ _layman()
+ {
+ local cur prev opts r_overlays l_overlays
+ opts="-a --add -d --delete -s --sync -i --info -S --sync-all -L --list \
+ -l --list-local -f --fetch -n --nofetch -p --priority -c --config \
+ -o --overlays -v --verbose -q --quiet -N --nocolor -Q --quietness \
+ -k --nocheck --debug --debug-level --debug-verbose --debug-methods \
+ --debug-classes --debug-variables --debug-class-vars --debug-nocolor"
+
+ r_overlays="$(layman -LkN 2>/dev/null | grep '(source' | awk '{print $2}')"
+ l_overlays="$(layman -lkN 2>/dev/null | grep '(source' | awk '{print $2}')"
+ ls_overlays="${l_overlays} ALL"
+
+ COMPREPLY=()
+
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]]
+ then
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ return 0
+ fi
+
+ case "${prev}" in
+ -a|--add)
+ COMPREPLY=($(compgen -W "${r_overlays}" -- ${cur}))
+ return 0
+ ;;
+ -d|--delete)
+ COMPREPLY=($(compgen -W "${l_overlays}" -- "${cur}"))
+ return 0
+ ;;
+ -s|--sync)
+ COMPREPLY=($(compgen -W "${ls_overlays}" -- "${cur}"))
+ return 0
+ ;;
+ -i|--info)
+ COMPREPLY=($(compgen -W "${r_overlays}" -- "${cur}"))
+ return 0
+ ;;
+ -p|--priority)
+ COMPREPLY=($(compgen -W "$(seq 0 100)" -- "${cur}"))
+ return 0
+ ;;
+ -Q|--quietness)
+ COMPREPLY=($(compgen -W "$(seq 0 4)" -- "${cur}"))
+ return 0
+ ;;
+ --debug-level)
+ COMPREPLY=($(compgen -W "$(seq 0 10)" -- "${cur}"))
+ return 0
+ ;;
+ --debug-verbose)
+ COMPREPLY=($(compgen -W "$(seq 1 3)" -- "${cur}"))
+ return 0
+ ;;
+ esac
+ }
+ complete -F _layman layman
+}
+
+# vim: set ft=sh tw=80 sw=4 et :