mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-09-26 11:38:01 +00:00
[New] nvm ls
: add --no-alias
to suppress alias output
Per https://github.com/creationix/nvm/issues/1792#issuecomment-466696504
This commit is contained in:
8
nvm.sh
8
nvm.sh
@@ -3138,10 +3138,12 @@ nvm() {
|
||||
"ls" | "list")
|
||||
local PATTERN
|
||||
local NVM_NO_COLORS
|
||||
local NVM_NO_ALIAS
|
||||
while [ $# -gt 0 ]; do
|
||||
case "${1}" in
|
||||
--) ;;
|
||||
--no-colors) NVM_NO_COLORS="${1}" ;;
|
||||
--no-alias) NVM_NO_ALIAS="${1}" ;;
|
||||
--*)
|
||||
nvm_err "Unsupported option \"${1}\"."
|
||||
return 55
|
||||
@@ -3152,12 +3154,16 @@ nvm() {
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ -n "${PATTERN-}" ] && [ -n "${NVM_NO_ALIAS}" ]; then
|
||||
nvm_err '`--no-alias` is not supported when a pattern is provided.'
|
||||
return 55
|
||||
fi
|
||||
local NVM_LS_OUTPUT
|
||||
local NVM_LS_EXIT_CODE
|
||||
NVM_LS_OUTPUT=$(nvm_ls "${PATTERN-}")
|
||||
NVM_LS_EXIT_CODE=$?
|
||||
NVM_NO_COLORS="${NVM_NO_COLORS-}" nvm_print_versions "${NVM_LS_OUTPUT}"
|
||||
if [ -z "${PATTERN-}" ]; then
|
||||
if [ -z "${NVM_NO_ALIAS-}" ] && [ -z "${PATTERN-}" ]; then
|
||||
if [ -n "${NVM_NO_COLORS-}" ]; then
|
||||
nvm alias --no-colors
|
||||
else
|
||||
|
Reference in New Issue
Block a user