c7221c5f257fc42ec8f6c6a6463bc8a5da25b00f

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

style(installer): prefix formatting variables with `FMT_`

Diff

This diff is truncated to protect this page.

  1diff --git a/tools/install.sh b/tools/install.sh
  2index d3f1ee640dc6b33d5462b830401cd066287f14f8..b4b90a62dd98618b64c227293be6637385a171df 100755
  3--- a/tools/install.sh
  4+++ b/tools/install.sh
  5@@ -190,24 +190,24 @@ fmt_code() {
  6 }
  7 
  8 fmt_error() {
  9-  printf '%sError: %s%s\n' "$BOLD$RED" "$*" "$RESET" >&2
 10+  printf '%sError: %s%s\n' "${FMT_BOLD}${FMT_RED}" "$*" "$FMT_RESET" >&2
 11 }
 12 
 13 setup_color() {
 14   # Only use colors if connected to a terminal
 15   if ! is_tty; then
 16-    RAINBOW=""
 17-    RED=""
 18-    GREEN=""
 19-    YELLOW=""
 20-    BLUE=""
 21-    BOLD=""
 22-    RESET=""
 23+    FMT_RAINBOW=""
 24+    FMT_RED=""
 25+    FMT_GREEN=""
 26+    FMT_YELLOW=""
 27+    FMT_BLUE=""
 28+    FMT_BOLD=""
 29+    FMT_RESET=""
 30     return
 31   fi
 32 
 33   if supports_truecolor; then
 34-    RAINBOW="
 35+    FMT_RAINBOW="
 36       $(printf '\033[38;2;255;0;0m')
 37       $(printf '\033[38;2;255;97;0m')
 38       $(printf '\033[38;2;247;255;0m')
 39@@ -217,7 +217,7 @@ setup_color() {
 40       $(printf '\033[38;2;245;0;172m')
 41     "
 42   else
 43-    RAINBOW="
 44+    FMT_RAINBOW="
 45       $(printf '\033[38;5;196m')
 46       $(printf '\033[38;5;202m')
 47       $(printf '\033[38;5;226m')
 48@@ -228,12 +228,12 @@ setup_color() {
 49     "
 50   fi
 51 
 52-  RED=$(printf '\033[31m')
 53-  GREEN=$(printf '\033[32m')
 54-  YELLOW=$(printf '\033[33m')
 55-  BLUE=$(printf '\033[34m')
 56-  BOLD=$(printf '\033[1m')
 57-  RESET=$(printf '\033[0m')
 58+  FMT_RED=$(printf '\033[31m')
 59+  FMT_GREEN=$(printf '\033[32m')
 60+  FMT_YELLOW=$(printf '\033[33m')
 61+  FMT_BLUE=$(printf '\033[34m')
 62+  FMT_BOLD=$(printf '\033[1m')
 63+  FMT_RESET=$(printf '\033[0m')
 64 }
 65 
 66 setup_ohmyzsh() {
 67@@ -244,7 +244,7 @@ setup_ohmyzsh() {
 68   # precedence over umasks except for filesystems mounted with option "noacl".
 69   umask g-w,o-w
 70 
 71-  echo "${BLUE}Cloning Oh My Zsh...${RESET}"
 72+  echo "${FMT_BLUE}Cloning Oh My Zsh...${FMT_RESET}"
 73 
 74   command_exists git || {
 75     fmt_error "git is not installed"
 76@@ -276,14 +276,14 @@ setup_zshrc() {
 77   # Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones
 78   # with datestamp of installation that moved them aside, so we never actually
 79   # destroy a user's original zshrc
 80-  echo "${BLUE}Looking for an existing zsh config...${RESET}"
 81+  echo "${FMT_BLUE}Looking for an existing zsh config...${FMT_RESET}"
 82 
 83   # Must use this exact name so uninstall.sh can find it
 84   OLD_ZSHRC=~/.zshrc.pre-oh-my-zsh
 85   if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
 86     # Skip this if the user doesn't want to replace an existing .zshrc
 87     if [ "$KEEP_ZSHRC" = yes ]; then
 88-      echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Keeping...${RESET}"
 89+      echo "${FMT_YELLOW}Found ~/.zshrc.${FMT_RESET} ${FMT_GREEN}Keeping...${FMT_RESET}"
 90       return
 91     fi
 92     if [ -e "$OLD_ZSHRC" ]; then
 93@@ -295,14 +295,14 @@ setup_zshrc() {
 94       fi
 95       mv "$OLD_ZSHRC" "${OLD_OLD_ZSHRC}"
 96 
 97-      echo "${YELLOW}Found old ~/.zshrc.pre-oh-my-zsh." \
 98-        "${GREEN}Backing up to ${OLD_OLD_ZSHRC}${RESET}"
 99+      echo "${FMT_YELLOW}Found old ~/.zshrc.pre-oh-my-zsh." \
100+        "${FMT_GREEN}Backing up to ${OLD_OLD_ZSHRC}${FMT_RESET}"
101     fi
102-    echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Backing up to ${OLD_ZSHRC}${RESET}"
103+    echo "${FMT_YELLOW}Found ~/.zshrc.${FMT_RESET} ${FMT_GREEN}Backing up to ${OLD_ZSHRC}${FMT_RESET}"
104     mv ~/.zshrc "$OLD_ZSHRC"