From 4211d37313fa736e906d1bb968d7e0b9c762559e Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sat, 8 Jan 2022 23:44:43 -0800 Subject: [PATCH] completion/subversion: load system completion Load the completion script from the subversion package installed on the system, instead of bundling a copy. This addresses Bash-it/bash-it#1818. NOTE: If `completions/system` is enabled, then it will load this same file anyway automatically. --- .../available/subversion.completion.bash | 7 ++++ completion/available/svn.completion.bash | 40 ------------------- 2 files changed, 7 insertions(+), 40 deletions(-) create mode 100644 completion/available/subversion.completion.bash delete mode 100644 completion/available/svn.completion.bash diff --git a/completion/available/subversion.completion.bash b/completion/available/subversion.completion.bash new file mode 100644 index 0000000000..742a0d22eb --- /dev/null +++ b/completion/available/subversion.completion.bash @@ -0,0 +1,7 @@ +# shellcheck shell=bash + +scm +if test -s "${SVN_EXE%/*}/../etc/bash_completion.d/subversion" +then + source "$_" +fi diff --git a/completion/available/svn.completion.bash b/completion/available/svn.completion.bash deleted file mode 100644 index 2f0a23fe97..0000000000 --- a/completion/available/svn.completion.bash +++ /dev/null @@ -1,40 +0,0 @@ -# shellcheck shell=bash -# -# Locate and load completions for `svn`. - -# Make sure svn is installed -_command_exists svn || return - -# Don't handle completion if it's already managed -if _completion_exists svn; then - _log_warning "completion already loaded - this usually means it is safe to stop using this completion" - return 0 -fi - -_svn_bash_completion_xcrun_svn= -if _command_exists xcrun; then - _svn_bash_completion_xcrun_svn="$(xcrun --find svn)" -fi -_svn_bash_completion_paths=( - # Standard locations - "${SVN_EXE%/*}/../etc/bash_completion.d/subversion" - # MacOS non-system locations - "${_svn_bash_completion_xcrun_svn%/bin/svn}/etc/bash_completion.d/subversion" -) - -# Load the first completion file found -_svn_bash_completion_found=false -for _comp_path in "${_svn_bash_completion_paths[@]}"; do - if [[ -r "$_comp_path" ]]; then - _svn_bash_completion_found=true - # shellcheck disable=SC1090 # don't follow - source "$_comp_path" - break - fi -done - -# Cleanup -if [[ "${_svn_bash_completion_found}" == false ]]; then - _log_warning "no completion files found - please try enabling the 'system' completion instead." -fi -unset "${!_svn_bash_completion@}"