Skip to content
Myr

Don’t restrict colors to TTYs.

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

This restriction prevents subcommands from producing colors and passing them up the tree to the actual TTY.

authored by Jordan Harband · committed by Jordan Harband · parent 0880539 · Browse files · 3 files+7 added−5 removed
This commit

State

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

Diff stats

3 files+7 added−5 removed

  • tests:+6 added−2 removed
  • other:+1 added−3 removed

3 files+7 added−5 removed

modified:test/fast/Aliases/nvm_ensure_default_set+3 added-1 removed
1#!/bin/sh23. ../../common.sh45die () { echo $@ ; exit 1; }67. ../../../nvm.sh8
6 unmodified lines
15OUTPUT="$(nvm_ensure_default_set 0.2)"16EXPECTED_OUTPUT="Creating default alias: default -> 0.2 (-> iojs-v0.2.10)"17EXIT_CODE="$?"1817[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'nvm_ensure_default_set 0.2' did not output '$EXPECTED_OUTPUT', got '$OUTPUT'"19[ "_$(echo "$OUTPUT" | strip_colors)" = "_$EXPECTED_OUTPUT" ] || die "'nvm_ensure_default_set 0.2' did not output '$EXPECTED_OUTPUT', got '$OUTPUT'"20[ "_$EXIT_CODE" = "_0" ] || die "'nvm_ensure_default_set 0.2' did not exit with 0, got $EXIT_CODE"
modified:test/fast/Unit tests/nvm_ensure_default_set+3 added-1 removed
1#!/bin/sh23. ../../common.sh45die () { echo $@ ; exit 1; }67. ../../../nvm.sh89EXPECTED_OUTPUT="nvm_ensure_default_set: a version is required"10OUTPUT="$(nvm_ensure_default_set 2>&1 >/dev/null)"11EXIT_CODE="$?"10[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'nvm_ensure_default_set' did not output "$EXPECTED_OUTPUT", got "$OUTPUT""12[ "_$(echo "$OUTPUT" | strip_colors)" = "_$EXPECTED_OUTPUT" ] || die "'nvm_ensure_default_set' did not output "$EXPECTED_OUTPUT", got "$OUTPUT""13[ "_$EXIT_CODE" = "_1" ] || die "'nvm_ensure_default_set' did not exit with 1, got "$EXIT_CODE""1415# see test/fast/Aliases for remaining nvm_ensure_default_set tests
modified:nvm.sh+1 added-3 removed
32 unmodified lines
33}3435nvm_has_colors() {36 local NVM_COLORS37 if test -t 1; then38 NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)"37 NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)"39 fi38 [ "${NVM_COLORS:--1}" -ge 8 ]39}4041nvm_get_latest() {
2576 unmodified lines