mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
Disable colors when stdout is not a terminal.
Fixes nvm-sh/nvm##2497
This commit is contained in:
parent
a284af9228
commit
2715201ca1
17
nvm.sh
17
nvm.sh
@ -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
|
||||
@ -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
|
||||
@ -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}" &&:)"
|
||||
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user