This commit is contained in:
Jephté Clain 2015-03-18 17:54:45 +04:00
parent e8d683b91a
commit 163df888d8
2 changed files with 6 additions and 5 deletions

View File

@ -17,7 +17,7 @@ if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
esac
fi
if [ -n "$BASH_COMPLETION" ]; then
for i in "$@@dest@@/lib/bash_completion.d/"*; do
for i in "@@dest@@/lib/bash_completion.d/"*; do
[ -f "$i" ] || continue
source "$i"
done

View File

@ -8,17 +8,18 @@
uprovide bash_completion
function __is_bash_completion_enabled() {
[ -n "$BASH_COMPLETION" ] && return 0
[ -n "$__NUTOOLS_BASH_COMPLETION" ] && return 0
grep -qE '^[ \t]*(\.|source)[ \t]*/usr/share/bash-completion/bash_completion' /etc/bash.bashrc && return 0
grep -qE '^[ \t]*(\.|source)[ \t]*/usr/share/bash-completion/bash_completion' ~/.bashrc && return 0
return 1
}
function __is_bash_completion_module_enabled() {
[ -f "/usr/share/bash-completion/completions/$1" ] && return 0
[ -n "$BASH_COMPLETION_COMPAT_DIR" -a -f "$BASH_COMPLETION_COMPAT_DIR/$1" ]
[ -n "$BASH_COMPLETION_COMPAT_DIR" -a -f "$BASH_COMPLETION_COMPAT_DIR/$1" ] && return 0
return 1
}
if ! __is_bash_completion_enabled; then
export BASH_COMPLETION=1
:
export __NUTOOLS_BASH_COMPLETION=1
fi
[ -n "$BASH_COMPLETION" ] || export BASH_COMPLETION=1