Fix ansible-test color ls logic.

This commit is contained in:
Matt Clay 2020-01-28 11:24:56 -08:00
parent 428aaf7e65
commit 21069c84d9
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ansible-test now enables color ``ls`` on a remote host only if the host supports the feature

View file

@ -101,7 +101,11 @@ fi
# Improve prompts on remote host for interactive use.
# shellcheck disable=SC1117
cat << EOF > ~/.bashrc
alias ls='ls -G'
if ls --color > /dev/null 2>&1; then
alias ls='ls --color'
elif ls -G > /dev/null 2>&1; then
alias ls='ls -G'
fi
export PS1='\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
EOF