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.

# Conflicts:
#	completion/available/system.completion.bash
  • Loading branch information
gaelicWizard committed Jul 26, 2021
1 parent a3b9e9c commit 197f6eb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion completion/available/system.completion.bash
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,8 @@ 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

0 comments on commit 197f6eb

Please sign in to comment.