completion/system: `shfmt`

My apologies to future `git blame` hunters ♥
pull/2013/head
John D Pell 2022-01-01 22:19:33 -08:00
parent e7c3263f12
commit 5fab574bfd
2 changed files with 36 additions and 37 deletions

View File

@ -72,6 +72,7 @@ completion/available/pipenv.completion.bash
completion/available/pipx.completion.bash completion/available/pipx.completion.bash
completion/available/rustup.completion.bash completion/available/rustup.completion.bash
completion/available/sdkman.completion.bash completion/available/sdkman.completion.bash
completion/available/system.completion.bash
completion/available/vault.completion.bash completion/available/vault.completion.bash
completion/available/vuejs.completion.bash completion/available/vuejs.completion.bash
completion/available/wpscan.completion.bash completion/available/wpscan.completion.bash

View File

@ -6,57 +6,55 @@
# Load before other completions # Load before other completions
# BASH_IT_LOAD_PRIORITY: 325 # BASH_IT_LOAD_PRIORITY: 325
if shopt -qo nounset # Bash-completion is too large and complex to expect to handle unbound variables throughout the whole codebase.
then # Bash-completion is too large and complex to expect to handle unbound variables throughout the whole codebase. if shopt -qo nounset; then
__bash_it_restore_nounset=true __bash_it_restore_nounset=true
shopt -uo nounset shopt -uo nounset
else else
__bash_it_restore_nounset=false __bash_it_restore_nounset=false
fi fi
if [[ -r "${BASH_COMPLETION:-}" ]] ; then if [[ -r "${BASH_COMPLETION:-}" ]]; then
# shellcheck disable=SC1091 # shellcheck disable=SC1090
source "${BASH_COMPLETION}" source "${BASH_COMPLETION}"
elif [[ -r /etc/bash_completion ]] ; then elif [[ -r /etc/bash_completion ]]; then
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source /etc/bash_completion source /etc/bash_completion
# Some distribution makes use of a profile.d script to import completion. # Some distribution makes use of a profile.d script to import completion.
elif [[ -r /etc/profile.d/bash_completion.sh ]] ; then elif [[ -r /etc/profile.d/bash_completion.sh ]]; then
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source /etc/profile.d/bash_completion.sh source /etc/profile.d/bash_completion.sh
elif _bash_it_homebrew_check elif _bash_it_homebrew_check; then
then : "${BASH_COMPLETION_COMPAT_DIR:=$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d}"
: ${BASH_COMPLETION_COMPAT_DIR:=$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d}
case "${BASH_VERSION}" in case "${BASH_VERSION}" in
1*|2*|3.0*|3.1*) 1* | 2* | 3.0* | 3.1*)
_log_warning "Cannot load completion due to version of shell. Are you using Bash 3.2+?" _log_warning "Cannot load completion due to version of shell. Are you using Bash 3.2+?"
;; ;;
3.2*|4.0*|4.1*) 3.2* | 4.0* | 4.1*)
# Import version 1.x of bash-completion, if installed. # Import version 1.x of bash-completion, if installed.
BASH_COMPLETION="$BASH_IT_HOMEBREW_PREFIX/opt/bash-completion@1/etc/bash_completion" BASH_COMPLETION="$BASH_IT_HOMEBREW_PREFIX/opt/bash-completion@1/etc/bash_completion"
if [[ -r "$BASH_COMPLETION" ]] ; then if [[ -r "$BASH_COMPLETION" ]]; then
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$BASH_COMPLETION" source "$BASH_COMPLETION"
else else
unset BASH_COMPLETION unset BASH_COMPLETION
fi fi
;; ;;
4.2*|5*|*) 4.2* | 5* | *)
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path # homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
if [[ -r "$BASH_IT_HOMEBREW_PREFIX"/etc/profile.d/bash_completion.sh ]] ; then if [[ -r "${BASH_IT_HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]; then
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "$BASH_IT_HOMEBREW_PREFIX"/etc/profile.d/bash_completion.sh source "${BASH_IT_HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
fi fi
;; ;;
esac esac
fi fi
if $__bash_it_restore_nounset if [[ ${__bash_it_restore_nounset:-false} == "true" ]]; then
then
shopt -so nounset shopt -so nounset
fi fi
unset __bash_it_restore_nounset unset __bash_it_restore_nounset