The shell builtin command return can be used to exit early from a file sourced with . or source.
bash_completion could protect itself from being re-sourced by doing
type __reassemble_comp_words_by_ref 2>/dev/null && return
Or maybe
complete -p paste 2>/dev/null && return
So complete -r; source /usr/share/bash-completion/bash_completion would re-load.
This still violates the expectation that users might have that if they changed stuff in /etc/bash_completion.d, they could just re-source the system bash_completion script.
Maybe
complete -p paste 2>/dev/null &&
echo "completions already loaded, complete -r before sourcing if you want them re-loaded" >&2 &&
return
The shell builtin command return can be used to exit early from a file sourced with . or source.
bash_completion could protect itself from being re-sourced by doing comp_words_ by_ref 2>/dev/null && return bash-completion /bash_completio n would re-load.
type __reassemble_
Or maybe
complete -p paste 2>/dev/null && return
So complete -r; source /usr/share/
This still violates the expectation that users might have that if they changed stuff in /etc/bash_ completion. d, they could just re-source the system bash_completion script.
Maybe
complete -p paste 2>/dev/null &&
echo "completions already loaded, complete -r before sourcing if you want them re-loaded" >&2 &&
return