shell commands: colourize messages
This commit is contained in:
parent
1d1cf36166
commit
0242084929
@ -26,8 +26,17 @@ esac
|
||||
# Higher depths mean this command was invoked by another Homebrew command.
|
||||
export HOMEBREW_COMMAND_DEPTH=$((HOMEBREW_COMMAND_DEPTH + 1))
|
||||
|
||||
ohai() {
|
||||
if [[ -t 1 && -z "$HOMEBREW_NO_COLOR" ]] # check whether stdout is a tty.
|
||||
then
|
||||
echo -e "\\033[34m==>\\033[0m \\033[1m$*\\033[0m" # blue arrow and bold text
|
||||
else
|
||||
echo "==> $*"
|
||||
fi
|
||||
}
|
||||
|
||||
onoe() {
|
||||
if [[ -t 2 ]] # check whether stderr is a tty.
|
||||
if [[ -t 2 && -z "$HOMEBREW_NO_COLOR" ]] # check whether stderr is a tty.
|
||||
then
|
||||
echo -ne "\\033[4;31mError\\033[0m: " >&2 # highlight Error with underline and red color
|
||||
else
|
||||
|
@ -36,11 +36,11 @@ homebrew-update-reset() {
|
||||
do
|
||||
[[ -d "$DIR/.git" ]] || continue
|
||||
cd "$DIR" || continue
|
||||
echo "==> Fetching $DIR..."
|
||||
ohai "Fetching $DIR..."
|
||||
git fetch --force --tags origin
|
||||
echo
|
||||
|
||||
echo "==> Resetting $DIR..."
|
||||
ohai "Resetting $DIR..."
|
||||
git checkout --force -B master origin/master
|
||||
echo
|
||||
done
|
||||
|
@ -87,7 +87,7 @@ fetch() {
|
||||
temporary_path="$CACHED_LOCATION.incomplete"
|
||||
|
||||
mkdir -p "$HOMEBREW_CACHE"
|
||||
[[ -n "$HOMEBREW_QUIET" ]] || echo "==> Downloading $VENDOR_URL" >&2
|
||||
[[ -n "$HOMEBREW_QUIET" ]] || ohai "Downloading $VENDOR_URL" >&2
|
||||
if [[ -f "$CACHED_LOCATION" ]]
|
||||
then
|
||||
[[ -n "$HOMEBREW_QUIET" ]] || echo "Already downloaded: $CACHED_LOCATION" >&2
|
||||
@ -107,7 +107,7 @@ fetch() {
|
||||
|
||||
if [[ ! -f "$temporary_path" ]]
|
||||
then
|
||||
[[ -n "$HOMEBREW_QUIET" ]] || echo "==> Downloading $VENDOR_URL2" >&2
|
||||
[[ -n "$HOMEBREW_QUIET" ]] || ohai "Downloading $VENDOR_URL2" >&2
|
||||
"$HOMEBREW_CURL" "${curl_args[@]}" "$VENDOR_URL2" -o "$temporary_path"
|
||||
fi
|
||||
|
||||
@ -180,7 +180,7 @@ install() {
|
||||
fi
|
||||
|
||||
safe_cd "$VENDOR_DIR"
|
||||
[[ -n "$HOMEBREW_QUIET" ]] || echo "==> Pouring $(basename "$VENDOR_URL")" >&2
|
||||
[[ -n "$HOMEBREW_QUIET" ]] || ohai "Pouring $(basename "$VENDOR_URL")" >&2
|
||||
tar "$tar_args" "$CACHED_LOCATION"
|
||||
safe_cd "$VENDOR_DIR/portable-$VENDOR_NAME"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user