Skip to content

Commit

Permalink
[New] Supercharge nvm debug output
Browse files Browse the repository at this point in the history
Try to get shell version, OS and its version, curl/wget version.
  • Loading branch information
PeterDaveHello committed Mar 24, 2017
1 parent e41197e commit 70693bd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions nvm.sh
Expand Up @@ -2249,6 +2249,35 @@ nvm() {
nvm_err "\$NPM_CONFIG_PREFIX: '$(nvm_sanitize_path "$NPM_CONFIG_PREFIX")'"
nvm_err "\$NVM_NODEJS_ORG_MIRROR: '${NVM_NODEJS_ORG_MIRROR}'"
nvm_err "\$NVM_IOJS_ORG_MIRROR: '${NVM_IOJS_ORG_MIRROR}'"
nvm_err "shell version: '$(${SHELL} --version | command head -n 1)'"
nvm_err "uname -a: '$(uname -a)'"
if [ "$(nvm_get_os)" = "darwin" ] && type sw_vers > /dev/null; then
nvm_err "OS version: $(sw_vers | command awk '{print $2}' | command xargs)"
elif [ -r "/etc/issue" ]; then
nvm_err "OS version: $(command head -n 1 /etc/issue | command sed 's/\\.//g')"
fi
if nvm_has "curl"; then
local CURL
if type curl | command grep -q hashed; then
CURL="$(type curl | command sed -E 's/\(|)//g' | command awk '{print $4}')"
elif type curl | command grep -q aliased; then
CURL="$(type curl | command awk '{ $1=$2=$3=$4="" ;print }')"
else
CURL="$(type curl)"
fi
nvm_err "curl: ${CURL}, $(command curl -V | command head -n 1)"
fi
if nvm_has "wget"; then
local WGET
if type wget | command grep -q hashed; then
WGET="$(type wget | command sed -E 's/\(|)//g' | command awk '{print $4}')"
elif type wget | command grep -q aliased; then
WGET="$(type wget | command awk '{ $1=$2=$3=$4="" ;print }')"
else
WGET="$(type wget)"
fi
nvm_err "wget: ${WGET}, $(command wget -V | command head -n 1)"
fi
local NVM_DEBUG_OUTPUT
for NVM_DEBUG_COMMAND in 'nvm current' 'which node' 'which iojs' 'which npm' 'npm config get prefix' 'npm root -g'
do
Expand Down

0 comments on commit 70693bd

Please sign in to comment.