Skip to content

Commit

Permalink
Use bash-completion@2 on Mac
Browse files Browse the repository at this point in the history
This is to avoid the bug where
  testprog > out<TAB>
will not split the line on the ">".

Using bash-completion v2 is what the kubernetes documentation says is
required for Mac anyway.

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
  • Loading branch information
marckhouzam committed Jul 1, 2021
1 parent d6cd4a9 commit d2938bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tests/bash/comp-test-lib.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ _completionTests_TEST_FAILED=0
# Setup bash_completion package
bashCompletionScript="/usr/share/bash-completion/bash_completion"
if [ $(uname) = "Darwin" ]; then
bashCompletionScript="/usr/local/etc/bash_completion"
bashCompletionScript="/usr/local/etc/profile.d/bash_completion.sh"
# Trick bash-completion into thinking this is an interactive shell
# See the if statement at the beginning of /usr/local/etc/profile.d/bash_completion.sh
PS1="%"
fi
source ${bashCompletionScript}

Expand Down
3 changes: 2 additions & 1 deletion tests/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ if [ "$(uname)" == "Darwin" ]; then
make clean && make build

if [ $SHELL_TYPE = bash ]; then
if which bash > /dev/null && [ -f /usr/local/etc/bash_completion ]; then
if which bash > /dev/null && [ -f /usr/local/etc/profile.d/bash_completion.sh ]; then
tests/bash/comp-tests.bash

# Test bashCompletionV2
Expand All @@ -198,6 +198,7 @@ if [ "$(uname)" == "Darwin" ]; then
else
echo
echo "Bash or bash_completion package not available locally, skipping MacOS"
echo "Please note that you must install bash_completion v2 (brew install bash-completion@2)"
fi
fi

Expand Down

0 comments on commit d2938bb

Please sign in to comment.