aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2007-01-05 14:43:37 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2007-01-05 14:43:37 +0000
commit2aa3c6d31c91666b571df41b1fbde2eb0d25a655 (patch)
treea3ff3a7cb905d970373b05e28aaec6b5dda30b45
parentd86c237b4c9ff80d7390c9068464c85739ba9118 (diff)
downloadpaludis-2aa3c6d31c91666b571df41b1fbde2eb0d25a655.tar.gz
paludis-2aa3c6d31c91666b571df41b1fbde2eb0d25a655.tar.xz
Add new options support to qualudis' bashcomp.
-rw-r--r--bash-completion/qualudis25
1 files changed, 24 insertions, 1 deletions
diff --git a/bash-completion/qualudis b/bash-completion/qualudis
index 150a765..4298ccc 100644
--- a/bash-completion/qualudis
+++ b/bash-completion/qualudis
@@ -5,16 +5,34 @@
# NOTE: This is still a work in progress, don't expect it to work well or
# properly right now.
+_qualudis_get_repodir() {
+ local repodir starting_dir="${1}"
+ [[ -f ./profiles/repo_name ]] && repodir=$(readlink -f ${starting_dir})
+ [[ -z "${repodir}" && -f ../profiles/repo_name ]] \
+ && repodir=$(readlink -f ${starting_dir}/..)
+ [[ -z "${repodir}" && -f ../../profiles/repo_name ]] \
+ && repodir=$(readlink -f ${starting_dir}/../..)
+ [[ -z "${repodir}" ]] && return 1
+ echo "${repodir}"
+}
+
_qualudis() {
local cur prev opts repodir
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
+ # Figure out what our repository dir is
+ [[ -d ${cur} ]] && repodir="$(_qualudis_get_repodir "${cur}")"
+ [[ -z "${repodir}" ]] && repodir="$(_qualudis_get_repodir "$(pwd)")"
+
opts="--describe -d \
--version -V \
--help -h \
--qa-check -c \
+ --exclude-qa-check -C \
+ --archs -a \
+ --excluded-arches -A \
--verbose -v \
--quiet -q \
--log-level -L \
@@ -38,11 +56,16 @@ _qualudis() {
return 0
;;
- --qa-check|-c)
+ --qa-check|-c|--exclude-qa-check|-C)
COMPREPLY=($(compgen -W "$(qualudis --log-level silent --describe |sed -n 's/^ \(.*\):$/\1/p')" -- "${cur}"))
return 0
;;
+ --arches|-a|--exclude-arches|-A)
+ COMPREPLY=($(compgen -W "$(< "${repodir}/profiles/arch.list")" -- "${cur}"))
+ return 0
+ ;;
+
*)
_filedir -d
;;