aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2007-10-21 18:45:32 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2007-10-21 18:45:32 +0000
commitee80215ef9b990fec2d92ba3b7b7e663c4e1d619 (patch)
tree9d8c152382b7aa54882d99080d073d8096522e60
parent29c98ae4d65fbcdd14d6492b648bbfb549c89806 (diff)
downloadpaludis-ee80215ef9b990fec2d92ba3b7b7e663c4e1d619.tar.gz
paludis-ee80215ef9b990fec2d92ba3b7b7e663c4e1d619.tar.xz
More bashcomp updates from zlin.
-rw-r--r--bash-completion/Makefile.am3
-rw-r--r--bash-completion/importare159
-rw-r--r--bash-completion/reconcilio2
3 files changed, 162 insertions, 2 deletions
diff --git a/bash-completion/Makefile.am b/bash-completion/Makefile.am
index 6279d0f..be1e736 100644
--- a/bash-completion/Makefile.am
+++ b/bash-completion/Makefile.am
@@ -1,7 +1,8 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_DATA = paludis adjutrix qualudis \
contrarius inquisitio \
- accerso instruo reconcilio
+ accerso instruo reconcilio \
+ importare
EXTRA_DIST = $(noinst_DATA)
built-sources : $(BUILT_SOURCES)
diff --git a/bash-completion/importare b/bash-completion/importare
new file mode 100644
index 0000000..d9a139a
--- /dev/null
+++ b/bash-completion/importare
@@ -0,0 +1,159 @@
+# Bash completion function for importare
+# 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.
+
+_importare() {
+ local cur prev opts action
+
+ local action_opts general_opts source_opts
+ local install_opts deplist_opts all_opts
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ action_opts="--install -i \
+ --version -V \
+ --help -h"
+ general_opts="--log-level \
+ --no-colour \
+ --no-color \
+ --environment -E"
+ source_opts="--location -l"
+ deplist_opts="--dl-reinstall \
+ --dl-reinstall-scm \
+ --dl-upgrade \
+ --dl-new-slots \
+ --dl-downgrade \
+ --dl-deps-default \
+ --dl-installed-deps-pre \
+ --dl-installed-deps-runtime \
+ --dl-installed-deps-post \
+ --dl-uninstalled-deps-pre \
+ --dl-uninstalled-deps-runtime \
+ --dl-uninstalled-deps-post \
+ --dl-uninstalled-deps-suggested \
+ --dl-suggested \
+ --dl-circular \
+ --dl-blocks \
+ --dl-override-masks \
+ --dl-fall-back"
+ install_opts="--pretend -p \
+ --destinations -d \
+ --no-config-protection \
+ --show-reasons \
+ --show-use-descriptions \
+ --continue-on-failure \
+ ${source_opts} \
+ ${deplist_opts}"
+
+ all_opts="${action_opts} ${general_opts} ${source_opts} ${deplist_opts} ${install_opts} ${install_opts}"
+
+ local x
+ for x in "${COMP_WORDS[@]}" ; do
+ case "${x}" in
+ --install|-i)
+ action="install"
+ break
+ ;;
+ --version|-V|--help|-h)
+ action="info"
+ break
+ ;;
+ esac
+ done
+
+ case "${cur}" in
+ -*)
+ local opts=
+ [[ -z "${action}" ]] && action="all"
+ opts="${action}_opts"
+
+ COMPREPLY=($(compgen -W "${general_opts} ${!opts}" -- "${cur}"))
+ return 0
+ ;;
+ *)
+ case "${prev}" in
+ ## Enum operators
+ --log-level|-L)
+ COMPREPLY=($(compgen -W "debug qa warning silent" -- "${cur}"))
+ return 0
+ ;;
+ --show-reasons)
+ COMPREPLY=($(compgen -W "none summary full" -- "${cur}"))
+ return 0
+ ;;
+ --show-use-descriptions)
+ COMPREPLY=($(compgen -W "none new changed all" -- "${cur}"))
+ return 0
+ ;;
+ --continue-on-failure)
+ COMPREPLY=($(compgen -W "if-fetch-only never if-satisfied always" -- "${cur}"))
+ return 0
+ ;;
+
+ --location|-l)
+ _filedir -d
+ return 0
+ ;;
+
+ --dl-reinstall)
+ COMPREPLY=($(compgen -W "never always if-use-changed" -- "${cur}"))
+ return 0
+ ;;
+ --dl-reinstall-scm)
+ COMPREPLY=($(compgen -W "never always daily weekly" -- "${cur}"))
+ return 0
+ ;;
+ --dl-upgrade)
+ COMPREPLY=($(compgen -W "always as-needed" -- "${cur}"))
+ return 0
+ ;;
+ --dl-new-slots)
+ COMPREPLY=($(compgen -W "always as-needed" -- "${cur}"))
+ return 0
+ ;;
+ --dl-downgrade)
+ COMPREPLY=($(compgen -W "as-needed warning error" -- "${cur}"))
+ return 0
+ ;;
+ --dl-deps-default|--dl-installed-deps-pre|--dl-installed-deps-runtime|--dl-installed-deps-post|--dl-uninstalled-deps-pre|--dl-uninstalled-deps-runtime|--dl-uninstalled-deps-post|--dl-uninstalled-deps-suggested)
+ COMPREPLY=($(compgen -W "pre pre-or-post post try-post discard" -- "${cur}"))
+ return 0
+ ;;
+
+ --dl-suggested)
+ COMPREPLY=($(compgen -W "show install discard" -- "${cur}"))
+ return 0
+ ;;
+ --dl-circular)
+ COMPREPLY=($(compgen -W "error discard" -- "${cur}"))
+ return 0
+ ;;
+ --dl-blocks)
+ COMPREPLY=($(compgen -W "accumulate error discard" -- "${cur}"))
+ return 0
+ ;;
+ --dl-override-masks)
+ COMPREPLY=($(compgen -W "tilde-keyword unkeyworded profile repository license" -- "${cur}"))
+ return 0
+ ;;
+ --dl-fall-back)
+ COMPREPLY=($(compgen -W "as-needed-except-targets as-needed never" -- "${cur}"))
+ return 0
+ ;;
+ *)
+ case "${action}" in
+ --install|-i)
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+}
+
+complete -o filenames -F _importare importare
diff --git a/bash-completion/reconcilio b/bash-completion/reconcilio
index 2e2453f..668cfbd 100644
--- a/bash-completion/reconcilio
+++ b/bash-completion/reconcilio
@@ -77,7 +77,7 @@ _reconcilio() {
[[ -z "${action}" ]] && action="all"
opts="${action}_opts"
- COMPREPLY=($(compgen -W "${!opts}" -- "${cur}"))
+ COMPREPLY=($(compgen -W "${general_opts} ${!opts}" -- "${cur}"))
return 0
;;
*)