nutools/lib/bashrc.d/bash_completion.shared

37 lines
1.3 KiB
Bash
Raw Permalink Normal View History

2013-09-30 06:40:51 +04:00
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
##@before *
2013-09-30 06:40:51 +04:00
if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
2015-03-26 20:47:12 +04:00
function __bash_completion_enabled() { return 1; }
function __bash_completion_module_enabled() { return 1; }
_file=
if [ -n "$UTOOLS_BASH_COMPLETION_COMPAT" ]; then
_file="@@dest@@/lib/ulib/$UTOOLS_BASH_COMPLETION_COMPAT/bash_completion"
elif [ -f /etc/debian_version ]; then
case "$(</etc/debian_version)" in
6*|squeeze*)
# le code suivant n'est compatible qu'avec debian squeeze (plus
# exactement, avec bash 4.0)
_file="@@dest@@/lib/ulib/bash40/bash_completion"
;;
7*|wheezy*|8*|jessie*|9*|stretch*|10*|buster*)
# le code suivant n'est compatible qu'avec debian wheezy et
# supérieur (plus exactement, avec bash 4.1)
_file="@@dest@@/lib/ulib/bash41/bash_completion"
;;
esac
fi
[ -f "$_file" ] && source "$_file"
unset _file
2015-03-26 20:53:48 +04:00
if __bash_completion_enabled; then
for i in "@@dest@@/lib/completion.d/"*; do
[ -f "$i" ] || continue
source "$i"
done
for i in "$HOME/etc/completion.d/"*; do
[ -f "$i" ] || continue
source "$i"
done
fi
2013-09-30 06:40:51 +04:00
fi