diff options
author | Aron Griffis <agriffis@gentoo.org> | 2006-11-20 23:06:15 +0000 |
---|---|---|
committer | Aron Griffis <agriffis@gentoo.org> | 2006-11-20 23:06:15 +0000 |
commit | 2888d092d2be4af293d0da2e53470e256ff5543f (patch) | |
tree | b80de1ac0d040bdd8cbb7cc93f487147f4b39291 /app-shells/bash-completion/files/bash-completion.sh | |
parent | mask net-analyzer/wireshark until sec-policy/selinux-wireshark is keyworded f... (diff) | |
download | gentoo-2-2888d092d2be4af293d0da2e53470e256ff5543f.tar.gz gentoo-2-2888d092d2be4af293d0da2e53470e256ff5543f.tar.bz2 gentoo-2-2888d092d2be4af293d0da2e53470e256ff5543f.zip |
Break /etc/bash_completion into /usr/share/bash-completion/{.pre,base,.post}
so that the base definitions can be eselected. Rename
/etc/profile.d/bash-completion to have a .sh extension so it's loaded
automatically by /etc/profile. This is okay because it doesn't do anything
until modules have been eselected. All of this makes it possible to
configure bash-completions entirely with eselect instead of needing to add
snippets to one's .bashrc
(Portage version: 2.1.2_rc1-r7)
Diffstat (limited to 'app-shells/bash-completion/files/bash-completion.sh')
-rw-r--r-- | app-shells/bash-completion/files/bash-completion.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/app-shells/bash-completion/files/bash-completion.sh b/app-shells/bash-completion/files/bash-completion.sh new file mode 100644 index 000000000000..36a194508a4e --- /dev/null +++ b/app-shells/bash-completion/files/bash-completion.sh @@ -0,0 +1,44 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/app-shells/bash-completion/files/bash-completion.sh,v 1.1 2006/11/20 23:06:15 agriffis Exp $ +# +# START bash completion -- do not remove this line + +# Need interactive bash with complete builtin +if [ -n "$PS1" -a -n "$BASH_VERSION" -a \ + "`type -t complete 2>/dev/null`" = builtin ] +then + _load_completions() { + declare f x loaded_pre=false + for f; do + if [[ -f $f ]]; then + # Some modules, including default, depend on the definitions + # in .pre. See the ebuild for how this is created. + if ! $loaded_pre; then + BASH_COMPLETION=/usr/share/bash-completion/base + source /usr/share/bash-completion/.pre + loaded_pre=true + fi + source "$f" + fi + done + + # Clean up + $loaded_pre && source /usr/share/bash-completion/.post + unset -f _load_completions + } + + # 1. Load defaults, if eselected. This was previously known as + # /etc/bash_completion + # 2. Load completion modules, maintained via eselect bashcomp --global + # 3. Load user completion modules, maintained via eselect bashcomp + # 4. Load user completion file last, overrides modules at user discretion + _load_completions \ + /etc/bash_completion.d/default \ + ~/.bash_completion.d/default \ + /etc/bash_completion.d/* \ + ~/.bash_completion.d/* \ + ~/.bash_completion +fi + +# END bash completion -- do not remove this line |