diff options
Diffstat (limited to 'bash-completion/paludis')
-rw-r--r-- | bash-completion/paludis | 374 |
1 files changed, 0 insertions, 374 deletions
diff --git a/bash-completion/paludis b/bash-completion/paludis deleted file mode 100644 index 832bac7..0000000 --- a/bash-completion/paludis +++ /dev/null @@ -1,374 +0,0 @@ -# Bash completion function for paludis -# 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. - -_paludis_packagenames() { - for names_cache in $(paludis --list-repositories --log-level silent |sed -n 's,^[[:space:]]*names_cache:[[:space:]]*\(.*\)$,\1,p') - do - pushd "${names_cache}" 1>/dev/null - for d in * ; do - [[ -d "${d}" ]] || continue - pushd "${d}" 1>/dev/null - for x in "${1}"* ; do - [[ -f "${x}" ]] && echo $x - done - popd 1>/dev/null - done - popd 1>/dev/null - done -} - -_paludis_dolist() { - paludis --list-${1} --log-level silent |sed -n 's,^\* \(.*\),\1,p' -} - -_paludis() { - local cur prev opts action - - local action_opts general_opts deplist_opts - local query_opts install_opts uninstall_opts sync_opts report_opts - local contents_opts owner_opts info_opts version_query_opts - local env_variable_query_opts conf_variable_query_opts - local list_opts regen_opts all_opts - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - action_opts="--query -q \ - --install -i \ - --uninstall -u \ - --uninstall-unused \ - --sync -s \ - --report -r \ - --contents -k \ - --executables \ - --owner -o \ - --config \ - --version -V \ - --info -I \ - --help -h \ - --has-version \ - --best-version \ - --match \ - --environment-variable \ - --configuration-variable \ - --list-repositories \ - --list-categories \ - --list-packages \ - --list-sets \ - --list-sync-protocols \ - --list-repository-formats \ - --list-dep-tag-categories \ - --regenerate-installed-cache \ - --regenerate-installable-cache" - general_opts="--log-level \ - --no-colour \ - --no-color \ - --no-suggestions \ - --environment -E \ - --resume-command-template \ - --multitask" - - deplist_opts="--dl-reinstall \ - --dl-reinstall-scm \ - --dl-reinstall-targets \ - --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" - - query_opts="--show-deps -D \ - --show-metadata -M \ - --compact \ - --no-compact" - install_opts="--pretend -p \ - --destinations -d \ - --preserve-world -1 \ - --add-to-world-spec \ - --fetch -f \ - --no-safe-resume \ - --show-reasons \ - --show-use-descriptions \ - --show-package-descriptions \ - --continue-on-failure \ - --skip-phase \ - --abort-at-phase \ - --skip-until-phase \ - --change-phases-for \ - --compact \ - ${deplist_opts}" - uninstall_opts="--pretend -p \ - --destinations -d \ - --preserve-world -1 \ - --show-reasons \ - --show-use-descriptions \ - --show-package-descriptions \ - --with-unused-dependencies \ - --permit-unsafe-uninstalls \ - --with-dependencies \ - --all-versions \ - ${deplist_opts}" - sync_opts="" - report_opts="" - contents_opts="" - owner_opts="--full-match" - info_opts="" - version_query_opts="" - env_variable_query_opts="" - conf_variable_query_opts="" - list_opts="--repository \ - --repository-format \ - --category \ - --package \ - --set" - regen_repos_opts="" - - all_opts="${action_opts} ${general_opts} ${query_opts} ${install_opts} ${uninstall_opts} ${sync_opts} ${report_opts} ${contents_opts} ${owner_opts} ${version_query_opts} ${variable_query_opts} ${list_opts} ${regen_repos_opts}" - - local x - for x in "${COMP_WORDS[@]}" ; do - case "${x}" in - -q|--query) - action="query" - break - ;; - -i|--install) - action="install" - break - ;; - -u|--uninstall|--uninstall-unused) - action="uninstall" - break - ;; - -s|--sync) - action="sync" - break - ;; - -r|--report) - action="report" - break - ;; - -k|--contents) - action="contents" - break - ;; - -o|--owner) - action="owner" - break - ;; - --config) - action="config" - break - ;; - -V|--version|-I|--info|-h|--help) - action="info" - break - ;; - --has-version|--best-version|--match) - action="version_query" - break - ;; - --environment-variable) - action="env_variable_query" - break - ;; - --configuration-variable) - action="conf_variable_query" - break - ;; - --list-repositories|--list-categories|--list-packages|--list-sets|--list-sync-protocols|--list-repository-formats|--list-dep-tag-categories) - action="list" - break - ;; - --regenerate-installed-cache|--regenerate-installable-cache) - action="regen_repos" - 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) - 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 - ;; - --show-package-descriptions) - COMPREPLY=($(compgen -W "none new all" -- "${cur}")) - return 0 - ;; - --continue-on-failure) - COMPREPLY=($(compgen -W "if-fetch-only never if-satisfied if-independent always" -- "${cur}")) - return 0 - ;; - --change-phases-for) - COMPREPLY=($(compgen -W "all first last" -- "${cur}")) - 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-reinstall-targets) - COMPREPLY=($(compgen -W "auto never always" -- "${cur}")) - return 0 - ;; - --dl-upgrade|--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-blocks) - COMPREPLY=($(compgen -W "accumulate error discard" -- "${cur}")) - return 0 - ;; - --dl-override-masks) - COMPREPLY=($(compgen -W "none tilde-keyword unkeyworded repository license" -- "${cur}")) - return 0 - ;; - - --dl-circular) - COMPREPLY=($(compgen -W "error discard" -- "${cur}")) - return 0 - ;; - --dl-fall-back) - COMPREPLY=($(compgen -W "as-needed-except-targets as-needed never" -- "${cur}")) - return 0 - ;; - ## list specifiers - --repository) - COMPREPLY=($(compgen -W "$(_paludis_dolist repositories)" -- "${cur}")) - return 0 - ;; - --repository-format) - COMPREPLY=($(compgen -W "$(_paludis_dolist repository-formats)" -- "${cur}")) - return 0 - ;; - --category) - COMPREPLY=($(compgen -W "$(_paludis_dolist categories)" -- "${cur}")) - return 0 - ;; - --package) - COMPREPLY=($(compgen -W "$(_paludis_packagenames "${cur}")" -- "${cur}")) - return 0 - ;; - --set) - COMPREPLY=($(compgen -W "$(_paludis_dolist sets)" -- "${cur}")) - return 0 - ;; - --owner|-o|--resume-command-template) - _filedir - return 0 - ;; - #=*|>*|>*|~*) - # : - # ;; - *) - case "${action}" in - sync|regen_repos) - COMPREPLY=($(compgen -W "$(_paludis_dolist repositories)" -- "${cur}")) - return 0 - ;; - report|info|list) - return 0 - ;; - owner) - _filedir - return 0 - ;; - conf_variable_query) - case "${prev}" in - -*) - COMPREPLY=($(compgen -W "$(_paludis_dolist repositories)" -- "${cur}")) - ;; - *) - COMPREPLY=($(compgen -W "$(paludis --log-level silent --list-repositories --repository ${prev} |sed -n 's,^ \([^:]*\).*,\1,p')" -- "${cur}")) - ;; - esac - return 0 - - ;; - query|install|uninstall|contents|version_query|env_variable_query|config) - if [[ "${action}" == "env_variable_query" \ - && "${prev}" != -* ]] - then - COMPREPLY=($(compgen -W "$(paludis --log-level silent --info |sed -n 's,^ \([A-Z][^:]*\):.*,\1,p')" -- "${cur}")) - return 0 - fi - # default - match on package names - case "${cur}" in - */*) - local catname=${cur%/*} - COMPREPLY=($(compgen -W "$(paludis --list-packages --log-level silent --category ${catname} |sed -n 's,^\* \(.*\),\1,p')" -- "${cur}")) - return 0 - ;; - *) - # Do set name, package name, and category name completion - COMPREPLY=( - $(compgen -W "$(_paludis_dolist sets)" -- "${cur}") - $(compgen -W "$(_paludis_dolist categories)" -- "${cur}") - $(compgen -W "$(_paludis_packagenames "${cur}")" -- "${cur}") - ) - _filedir - return 0 - ;; - esac - ;; - esac - ;; - esac - ;; - esac -} -complete -o filenames -F _paludis paludis |