Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable colors when stdout is not a terminal. #2634

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2714,6 +2714,10 @@ nvm() {
fi
done

if ! nvm_stdout_is_terminal; then
NVM_NO_COLORS="--no-colors"
fi

local INITIAL_COLOR_INFO
local RED_INFO
local GREEN_INFO
Expand Down Expand Up @@ -3747,6 +3751,11 @@ nvm() {
esac
shift
done

if ! nvm_stdout_is_terminal; then
NVM_NO_COLORS="--no-colors"
fi

if [ -n "${PATTERN-}" ] && [ -n "${NVM_NO_ALIAS-}" ]; then
nvm_err '`--no-alias` is not supported when a pattern is provided.'
return 55
Expand Down Expand Up @@ -3799,6 +3808,10 @@ nvm() {
shift
done

if ! nvm_stdout_is_terminal; then
NVM_NO_COLORS="--no-colors"
fi

local NVM_OUTPUT
local EXIT_CODE
NVM_OUTPUT="$(NVM_LTS="${NVM_LTS-}" nvm_remote_versions "${PATTERN}" &&:)"
Expand Down Expand Up @@ -3900,6 +3913,10 @@ nvm() {
shift
done

if ! nvm_stdout_is_terminal; then
NVM_NO_COLORS="--no-colors"
fi

if [ -z "${TARGET}" ]; then
# for some reason the empty string was explicitly passed as the target
# so, unalias it.
Expand Down