Skip to content

Commit

Permalink
completion/system: give up hope
Browse files Browse the repository at this point in the history
Give up and accept defeat that bash-completion can't reasonably be audited for unbound parameters. Wrap invocation with disabling strictness, and restore after if it was enabled.
  • Loading branch information
gaelicWizard committed Jul 26, 2021
1 parent a3b9e9c commit 93cc64f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion completion/available/system.completion.bash
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/usr/bin/env bash

#
# Loads the system's Bash completion modules.
# If Homebrew is installed (OS X), it's Bash completion modules are loaded.

if shopt -qo nounset
then # Bash-completion is too large and complex to expect to handle unbound variables throughout the whole codebase.
BASH_IT_RESTORE_NOUNSET=true
shopt -uo nounset
else
BASH_IT_RESTORE_NOUNSET=false
fi

if [[ -r /etc/bash_completion ]] ; then
# shellcheck disable=SC1091
source /etc/bash_completion
Expand All @@ -23,3 +31,9 @@ if [[ "$(uname -s)" == 'Darwin' ]] && _command_exists brew ; then
source "$BREW_PREFIX"/etc/profile.d/bash_completion.sh
fi
fi

if $BASH_IT_RESTORE_NOUNSET
then
shopt -so nounset
fi
unset BASH_IT_RESTORE_NOUNSET

0 comments on commit 93cc64f

Please sign in to comment.