Skip to content
Myr

Merge pull request #377 from koenpunt/remove-obscure-echo-test

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Replaced echo for printf when using formatted strings

authored by Jordan Harband · committed by Jordan Harband · parents 020f615, 70f1734 · Browse files · 2 files+12 added−21 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−21 removed

  • tests:+1 added−1 removed
  • other:+11 added−20 removed

2 files+12 added−21 removed

modified:test/fast/Running "nvm current" should display current nvm environment.+1 added-1 removed
1 unmodified line
23die () { echo $@ ; exit 1; }45. ../../nvm.sh6[ `expr "$(nvm current)" : ".*current"` != 0 ] || die "Failed to find current version"6[ "$(nvm current)" == `node -v` ] || die "Failed to find current version"
modified:nvm.sh+11 added-20 removed
24 unmodified lines
25 export NVM_DIR=$HOME/.nvm26 fi27fi2829DASH_E=""30[ -z "$(echo -n -e)" ] && DASH_E="-e"3129# Setup mirror location if not already set30if [ -z "$NVM_NODEJS_ORG_MIRROR" ]; then31 export NVM_NODEJS_ORG_MIRROR="http://nodejs.org/dist"32fi
103 unmodified lines
136 return 1137 fi138}139143colorize_version() {144 if [ -n "$DASH_E" ]; then145 echo $DASH_E "\033[0;34m$1\033[0m"146 else147 echo $1148 fi149}150140print_versions() {141 local VERSION153 local PADDED_VERSION154 for VERSION in $1; do155 PADDED_VERSION=`printf '%10s' $VERSION`156 if [ -d "$NVM_DIR/$VERSION" ]; then157 colorize_version "$PADDED_VERSION"142 local FORMAT143 local CURRENT=`nvm_version current`144 echo "$1" | while read VERSION; do145 if [ "$VERSION" == "$CURRENT" ]; then146 FORMAT='\033[0;32m-> %9s\033[0m'147 elif [ -d "$NVM_DIR/$VERSION" ]; then148 FORMAT='\033[0;34m%12s\033[0m'149 else159 echo "$PADDED_VERSION"150 FORMAT='%12s'151 fi152 printf "$FORMAT\n" $VERSION153 done154}155156nvm() {
309 unmodified lines
466 ;;467 "ls" | "list" )468 print_versions "`nvm_ls $2`"469 if [ $# -eq 1 ]; then478 printf "current: \t"; nvm_version current470 nvm alias471 fi472 return473 ;;
1 unmodified line
475 print_versions "`nvm_ls_remote $2`"476 return477 ;;478 "current" )488 echo $DASH_E -n "current: \t"; nvm_version current479 nvm_version current480 ;;481 "alias" )482 mkdir -p $NVM_DIR/alias483 if [ $# -le 2 ]; then
54 unmodified lines
538 rm -f $NVM_DIR/v* 2>/dev/null539 echo "Cache cleared."540 ;;541 "version" )551 colorize_version "`nvm_version $2`"542 nvm_version $2543 ;;544 * )545 nvm help546 ;;
5 unmodified lines