Comment 8 for bug 790043

Revision history for this message
Peter Cordes (peter-cordes) wrote :

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