parent
bbbc35af62
commit
9182dcf5ca
|
@ -17,7 +17,11 @@ 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/completion.d/"*; do
|
||||
[ -f "$i" ] || continue
|
||||
source "$i"
|
||||
done
|
||||
for i in "$HOME/etc/completion.d/"*; do
|
||||
[ -f "$i" ] || continue
|
||||
source "$i"
|
||||
done
|
||||
|
|
|
@ -7,10 +7,9 @@ function __nutools_host_completion() {
|
|||
_known_hosts_real "$cur"
|
||||
fi
|
||||
}
|
||||
complete -F __nutools_host_completion -o default ruinst runs rruns
|
||||
|
||||
if [ -n "$BASH_COMPLETION_DIR" -a -f "$BASH_COMPLETION_DIR/ssh" ]; then
|
||||
if __bash_completion_module_enabled ssh; then
|
||||
shopt -u hostcomplete
|
||||
complete -F _ssh ussh cssh
|
||||
fi
|
||||
|
||||
complete -F __nutools_host_completion -o default ruinst runs rruns
|
||||
|
|
|
@ -33,7 +33,8 @@ done
|
|||
./ulink --nutools-makelinks
|
||||
|
||||
# complétion programmable
|
||||
bcdir=lib/bash_completion.d
|
||||
mkdir -p ~/etc/completion.d
|
||||
bcdir=lib/completion.d
|
||||
./pdev --nutools-completion >"$bcdir/pdev"
|
||||
./todo/prel --nutools-completion >"$bcdir/prel"
|
||||
#./pfix --nutools-completion >"$bcdir/pfix"
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
##@require base
|
||||
uprovide bash_completion
|
||||
|
||||
function __is_bash_completion_enabled() {
|
||||
function __bash_completion_enabled() {
|
||||
[ -n "$BASH_COMPLETION" ]
|
||||
}
|
||||
function __is_bash_completion_module_enabled() {
|
||||
function __bash_completion_module_enabled() {
|
||||
[ -n "$BASH_COMPLETION_DIR" -a -f "$BASH_COMPLETION_DIR/$1" ]
|
||||
}
|
||||
|
||||
if ! __is_bash_completion_enabled; then
|
||||
if ! __bash_completion_enabled; then
|
||||
BASH_COMPLETION=1
|
||||
shopt -s extglob progcomp
|
||||
|
||||
|
|
|
@ -7,19 +7,19 @@
|
|||
##@require base
|
||||
uprovide bash_completion
|
||||
|
||||
function __is_bash_completion_enabled() {
|
||||
function __bash_completion_enabled() {
|
||||
[ -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() {
|
||||
function __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" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
if ! __is_bash_completion_enabled; then
|
||||
export __NUTOOLS_BASH_COMPLETION=1
|
||||
if ! __bash_completion_enabled; then
|
||||
__NUTOOLS_BASH_COMPLETION=1
|
||||
fi
|
||||
[ -n "$BASH_COMPLETION" ] || export BASH_COMPLETION=1
|
||||
[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=1
|
||||
|
|
Loading…
Reference in New Issue