Formatting and more bash colors

This commit is contained in:
Lynda Wang 2020-07-26 13:58:29 -04:00 committed by Michael Campagnaro
parent 74d2cb7c42
commit 8cd9f4aa39
8 changed files with 202 additions and 175 deletions

View File

@ -13,6 +13,8 @@ if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
GREEN="$(tput setaf 2)" GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)" YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)" BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
BOLD="$(tput bold)" BOLD="$(tput bold)"
NORMAL="$(tput sgr0)" NORMAL="$(tput sgr0)"
else else
@ -20,6 +22,8 @@ else
GREEN="" GREEN=""
YELLOW="" YELLOW=""
BLUE="" BLUE=""
MAGENTA=""
CYAN=""
BOLD="" BOLD=""
NORMAL="" NORMAL=""
fi fi

View File

@ -8,6 +8,8 @@ if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
GREEN="$(tput setaf 2)" GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)" YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)" BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
BOLD="$(tput bold)" BOLD="$(tput bold)"
NORMAL="$(tput sgr0)" NORMAL="$(tput sgr0)"
else else
@ -15,6 +17,8 @@ else
GREEN="" GREEN=""
YELLOW="" YELLOW=""
BLUE="" BLUE=""
MAGENTA=""
CYAN=""
BOLD="" BOLD=""
NORMAL="" NORMAL=""
fi fi

View File

@ -8,6 +8,8 @@ if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
GREEN="$(tput setaf 2)" GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)" YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)" BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
BOLD="$(tput bold)" BOLD="$(tput bold)"
NORMAL="$(tput sgr0)" NORMAL="$(tput sgr0)"
else else
@ -15,6 +17,8 @@ else
GREEN="" GREEN=""
YELLOW="" YELLOW=""
BLUE="" BLUE=""
MAGENTA=""
CYAN=""
BOLD="" BOLD=""
NORMAL="" NORMAL=""
fi fi

View File

@ -8,6 +8,8 @@ if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
GREEN="$(tput setaf 2)" GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)" YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)" BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
BOLD="$(tput bold)" BOLD="$(tput bold)"
NORMAL="$(tput sgr0)" NORMAL="$(tput sgr0)"
else else
@ -15,6 +17,8 @@ else
GREEN="" GREEN=""
YELLOW="" YELLOW=""
BLUE="" BLUE=""
MAGENTA=""
CYAN=""
BOLD="" BOLD=""
NORMAL="" NORMAL=""
fi fi

View File

@ -8,6 +8,8 @@ if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
GREEN="$(tput setaf 2)" GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)" YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)" BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
BOLD="$(tput bold)" BOLD="$(tput bold)"
NORMAL="$(tput sgr0)" NORMAL="$(tput sgr0)"
else else
@ -15,6 +17,8 @@ else
GREEN="" GREEN=""
YELLOW="" YELLOW=""
BLUE="" BLUE=""
MAGENTA=""
CYAN=""
BOLD="" BOLD=""
NORMAL="" NORMAL=""
fi fi

View File

@ -21,7 +21,6 @@ expand_path() {
ret="$ret/${parts[$i]}" ret="$ret/${parts[$i]}"
done done
fi fi
ret=$(readlink -m "$ret") ret=$(readlink -m "$ret")
echo $ret echo $ret
} }
@ -200,7 +199,7 @@ link_file() {
fi fi
if [[ $require_confirmation -eq 1 ]]; then if [[ $require_confirmation -eq 1 ]]; then
echo "${BOLD}${BLUE}Will attempt to link ${GREEN}$source_path${BLUE} to ${GREEN}$dest_path${BLUE}" echo "${BOLD}${BLUE}Will attempt to link ${YELLOW}$source_path${BLUE} to ${YELLOW}$dest_path${BLUE}"
printf "${BOLD}Enter 1 to proceed\n${YELLOW}> ${NORMAL}" printf "${BOLD}Enter 1 to proceed\n${YELLOW}> ${NORMAL}"
read confirm read confirm
if [[ $confirm != 1 ]]; then abort; fi if [[ $confirm != 1 ]]; then abort; fi
@ -212,7 +211,7 @@ link_file() {
echo Link cmd:: $link_cmd echo Link cmd:: $link_cmd
fi fi
printf "${BOLD}*${NORMAL} ${YELLOW}Linking '$source_path'${NORMAL} to ${YELLOW}'$dest_path'${NORMAL}\n" printf "${BOLD}${GREEN}==> ${NORMAL}Linking ${BOLD}${YELLOW}'$source_path'${NORMAL} to ${BOLD}${YELLOW}'$dest_path'${NORMAL}\n"
eval $link_cmd eval $link_cmd
} }
@ -222,7 +221,7 @@ function setup_file() {
if [ ! -f $dest ]; then if [ ! -f $dest ]; then
link_file $src $dest $confirm_link link_file $src $dest $confirm_link
else else
printf "${BOLD}*${NORMAL} ${YELLOW}'$dest'${NORMAL} already linked to ${YELLOW}'$src'${NORMAL}\n" printf "${BOLD}${MAGENTA}==> ${NORMAL}${BOLD}${YELLOW}'$dest'${NORMAL} already linked to ${BOLD}${YELLOW}'$src'${NORMAL}\n"
fi fi
} }
@ -232,7 +231,7 @@ function setup_dir() {
if [ ! -d $dest ]; then if [ ! -d $dest ]; then
link_file $src $dest $confirm_link link_file $src $dest $confirm_link
else else
printf "${BOLD}*${NORMAL} ${YELLOW}'$dest'${NORMAL} already linked to ${YELLOW}'$src'${NORMAL}\n" printf "${BOLD}${MAGENTA}==> ${NORMAL}${BOLD}${YELLOW}'$dest'${NORMAL} already linked to ${BOLD}${YELLOW}'$src'${NORMAL}\n"
fi fi
} }

View File

@ -8,6 +8,8 @@ if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
GREEN="$(tput setaf 2)" GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)" YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)" BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
BOLD="$(tput bold)" BOLD="$(tput bold)"
NORMAL="$(tput sgr0)" NORMAL="$(tput sgr0)"
else else
@ -15,6 +17,8 @@ else
GREEN="" GREEN=""
YELLOW="" YELLOW=""
BLUE="" BLUE=""
MAGENTA=""
CYAN=""
BOLD="" BOLD=""
NORMAL="" NORMAL=""
fi fi

View File

@ -8,6 +8,8 @@ if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
GREEN="$(tput setaf 2)" GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)" YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)" BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
BOLD="$(tput bold)" BOLD="$(tput bold)"
NORMAL="$(tput sgr0)" NORMAL="$(tput sgr0)"
else else
@ -15,6 +17,8 @@ else
GREEN="" GREEN=""
YELLOW="" YELLOW=""
BLUE="" BLUE=""
MAGENTA=""
CYAN=""
BOLD="" BOLD=""
NORMAL="" NORMAL=""
fi fi
@ -35,7 +39,7 @@ cwd=$PWD
uname_s="$(uname -s)" uname_s="$(uname -s)"
case "${uname_s}" in case "${uname_s}" in
Linux*) machine=Linux;; Linux*) machine=Linux;;
Darwin*) machine=Mac;; Darwin*) machine=MacOS;;
CYGWIN*) machine=Cygwin;; CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;; MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${uname_s}" *) machine="UNKNOWN:${uname_s}"