aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2006-11-13 00:04:02 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2006-11-13 00:04:02 +0000
commit178bf7a92313db98efacd38aad3eef703d111160 (patch)
tree5a7336815651adb2e2c97cc1fc62364e5a762d09
parent4594d04e1c65a22a2e184b5d3ebc3962a5d3690a (diff)
downloadpaludis-178bf7a92313db98efacd38aad3eef703d111160.tar.gz
paludis-178bf7a92313db98efacd38aad3eef703d111160.tar.xz
Add a bashcomp script for qualudis.
-rw-r--r--bash-completion/Makefile.am3
-rw-r--r--bash-completion/qualudis52
2 files changed, 54 insertions, 1 deletions
diff --git a/bash-completion/Makefile.am b/bash-completion/Makefile.am
index c3a49fc..4083c9b 100644
--- a/bash-completion/Makefile.am
+++ b/bash-completion/Makefile.am
@@ -1 +1,2 @@
-noinst_DATA = paludis adjutrix
+MAINTAINERCLEANFILES = Makefile.in
+noinst_DATA = paludis adjutrix qualudis
diff --git a/bash-completion/qualudis b/bash-completion/qualudis
new file mode 100644
index 0000000..c8f6831
--- /dev/null
+++ b/bash-completion/qualudis
@@ -0,0 +1,52 @@
+# Bash completion function for qualudis
+# Written by Mike Kelly
+# vim: set et sw=4 sts=4 ts=4 ft=sh :
+
+# NOTE: This is still a work in progress, don't expect it to work well or
+# properly right now.
+
+_qualudis() {
+ local cur prev opts repodir
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ opts="--describe -d \
+ --version -V \
+ --help -h \
+ --qa-check -c \
+ --verbose -v \
+ --quiet -q \
+ --log-level -L \
+ --message-level -M"
+
+ case "${cur}" in
+ -*)
+ COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
+ return 0
+ ;;
+ *)
+ case "${prev}" in
+ ## Enum operators
+ --log-level|-L)
+ COMPREPLY=($(compgen -W "debug qa warning silent" -- "${cur}"))
+ return 0
+ ;;
+ --message-level|-M)
+ COMPREPLY=($(compgen -W "info minor major fatal" -- "${cur}"))
+ return 0
+ ;;
+
+ --qa-check|-c)
+ COMPREPLY=($(compgen -W "$(qualudis --log-level silent --describe |sed -n 's/ \(.*\):/\1/p')" -- "${cur}"))
+ return 0
+ ;;
+
+ *)
+ COMPREPLY=($(compgen -d -- "${cur}"))
+ ;;
+ esac
+ ;;
+ esac
+}
+complete -o filenames -F _qualudis qualudis