aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2007-03-05 09:24:52 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2007-03-05 09:24:52 +0000
commit1d2b68951e5d3e5b2f542543e8ed9ea280543502 (patch)
tree92b3700820ed272f0246826b4214f9996254a809
parentc9c7d56d1835dae646887e9317a2ab858827b799 (diff)
downloadpaludis-1d2b68951e5d3e5b2f542543e8ed9ea280543502.tar.gz
paludis-1d2b68951e5d3e5b2f542543e8ed9ea280543502.tar.xz
Add a basic bashcomp script for inquisitio.
-rw-r--r--bash-completion/Makefile.am2
-rw-r--r--bash-completion/inquisitio67
2 files changed, 68 insertions, 1 deletions
diff --git a/bash-completion/Makefile.am b/bash-completion/Makefile.am
index 8a791e2..e90f498 100644
--- a/bash-completion/Makefile.am
+++ b/bash-completion/Makefile.am
@@ -1,5 +1,5 @@
MAINTAINERCLEANFILES = Makefile.in
-noinst_DATA = paludis adjutrix qualudis contrarius
+noinst_DATA = paludis adjutrix qualudis contrarius inquisitio
EXTRA_DIST = $(noinst_DATA)
built-sources : $(BUILT_SOURCES)
diff --git a/bash-completion/inquisitio b/bash-completion/inquisitio
new file mode 100644
index 0000000..5879dfd
--- /dev/null
+++ b/bash-completion/inquisitio
@@ -0,0 +1,67 @@
+# Bash completion function for inquisitio
+# 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.
+
+_inquisitio() {
+ local cur prev opts
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ opts="--search -s \
+ --version -V \
+ --help -h \
+ --log-level -L \
+ --no-colour -C \
+ --no-color \
+ --config-suffix -c \
+ --matcher -m \
+ --extractors -e \
+ --repository \
+ --repository-format \
+ --category \
+ --package"
+
+ 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
+ ;;
+
+ --matcher|-m)
+ COMPREPLY=($(compgen -W "text pcre" -- "${cur}"))
+ return 0
+ ;;
+ --extractors|-e)
+ COMPREPLY=($(compgen -W "description name homepage" -- "${cur}"))
+ return 0
+ ;;
+
+ --repository)
+ COMPREPLY=($(compgen -W "$(paludis --log-level silent --list-repositories |sed -n 's,^\* \(.*\),\1,p')" -- "${cur}"))
+ return 0
+ ;;
+ --repository-format)
+ COMPREPLY=($(compgen -W "$(paludis --log-level silent --list-repository-formats |sed -n 's,^\* \(.*\),\1,p')" -- "${cur}"))
+ return 0
+ ;;
+ --category)
+ COMPREPLY=($(compgen -W "$(paludis --log-level silent --list-categories |sed -n 's,^\* \(.*\),\1,p')" -- "${cur}"))
+ return 0
+ ;;
+
+ esac
+ ;;
+ esac
+}
+complete -F _inquisitio inquisitio