Commit 2c690098 authored by Seblu's avatar Seblu
Browse files

Do not print color without tty

parent bc5889c7
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -29,19 +29,26 @@ declare -a to_32 to_64

shopt -s nullglob

usage() {
	echo "usage: ${0##*/} [options] pkg ..." >&2
	echo 'options:' >&2
	echo "   -r: remove package after addition" >&2
	exit 2
}
if [[ -t 0 && -t 2 ]]; then
	GREEN='1;32m'
	BLUE='1;34m'
	BOLD='0;1m'
	RESET='m'
fi

msg() {
	printf "\e[1;32m==>\e[0;1m $1\e[m\n" "${@:1}"
	printf "$GREEN==>$BOLD $1$RESET\n" "${@:1}"
}

msg2() {
	printf "\e[1;34m  ->\e[0;1m $1\e[m\n" "${@:1}"
	printf "$BLUE  ->$BOLD $1$RESET\n" "${@:1}"
}

usage() {
	echo "usage: ${0##*/} [options] pkg ..." >&2
	echo 'options:' >&2
	echo "   -r: remove package after addition" >&2
	exit 2
}

# usage : in_array( $needle, $haystack )
+9 −2
Original line number Diff line number Diff line
@@ -26,12 +26,19 @@ shopt -s nullglob

declare -a to_commit

if [[ -t 0 && -t 2 ]]; then
	GREEN='1;32m'
	BLUE='1;34m'
	BOLD='0;1m'
	RESET='m'
fi

msg() {
	printf "\e[1;32m==>\e[0;1m $1\e[m\n" "${@:1}"
	printf "$GREEN==>$BOLD $1$RESET\n" "${@:1}"
}

msg2() {
	printf "\e[1;34m  ->\e[0;1m $1\e[m\n" "${@:1}"
	printf "$BLUE  ->$BOLD $1$RESET\n" "${@:1}"
}

# usage : in_array( $needle, $haystack )