colorizing complete

This commit is contained in:
Bryan Jenks 2020-04-19 03:37:50 -07:00
parent 7fba793c1c
commit bbcb7f4e1d
1 changed files with 12 additions and 9 deletions

21
flash
View File

@ -37,6 +37,9 @@ NC='\033[0m' # No Color
#ANSI BACKGROUND ESCAPE COLORS #ANSI BACKGROUND ESCAPE COLORS
WHITEBG='\033[1;47m' WHITEBG='\033[1;47m'
# FONT FORMAT EXCAPE CODES
BOLD='\e[1m'
PWD="$(pwd)" # Remember User's Starting Directory PWD="$(pwd)" # Remember User's Starting Directory
DIR="$HOME/.local/share/flash" # Where Decks Are Located DIR="$HOME/.local/share/flash" # Where Decks Are Located
EXAMPLE_DECK="$HOME/.local/share/flash/deck.csv" EXAMPLE_DECK="$HOME/.local/share/flash/deck.csv"
@ -84,12 +87,12 @@ Science:What is the distance between the Earth and Sol called?:An Astronomical U
Programming:Best operating system?:Arch, because BTW i run Arch:999" Programming:Best operating system?:Arch, because BTW i run Arch:999"
if [ ! -d $DIR ];then # If Directory does NOT exist if [ ! -d $DIR ];then # If Directory does NOT exist
echo "No '.local/share/flash' directory, make it? y/n" echo -e "No ${LRED}.local/share/flash${NC} directory, make it? ${LGREEN}y${NC}/${LRED}n${NC}"
read RESPONSE read RESPONSE
case "$RESPONSE" in case "$RESPONSE" in
[QqNn]) exit ;; [QqNn]) exit ;;
[Yy]) mkdir "$DIR" && touch $EXAMPLE_DECK && echo "$DECK_TEMPLATE" >> $EXAMPLE_DECK && echo -e "$DIR_MADE_MSG" && exit;; [Yy]) mkdir "$DIR" && touch $EXAMPLE_DECK && echo "$DECK_TEMPLATE" >> $EXAMPLE_DECK && echo -e "$DIR_MADE_MSG" && exit;;
*) echo "invalid choice, please select either 'y' or 'n'" && exit ;; *) echo -e "invalid choice, please select either ${LGREEN}y${NC} or ${LRED}n${NC}" && exit ;;
esac esac
fi fi
@ -105,26 +108,26 @@ DECK="$(find -maxdepth 999 -iname "*.csv" | fzf --preview='bat --theme="Solarize
main(){ main(){
IFS=$':'; read -a q <<<$(sort "$DECK" -n --field-separator=: --key=4 | head | shuf -n 1) IFS=$':'; read -a q <<<$(sort "$DECK" -n --field-separator=: --key=4 | head | shuf -n 1)
clear clear
echo -e "${WHITEBG}${WHITE}===========================================================${NC}" echo -e "${WHITEBG} Flash.sh - Flash Cards In Your Terminal ${NC}"
echo -e "${ORANGE}Cards Reviewed:${NC} $COUNTER" echo -e "${ORANGE}${BOLD}Cards ${BOLD}Reviewed:${NC} $COUNTER"
echo -e "${LGREY}Category:${NC} echo -e "${LGREY}Category:${NC}
${q[0]}" ${q[0]}"
echo -e "${LGREY}Question:${NC} echo -e "${LGREY}Question:${NC}
${q[1]}" ${q[1]}"
echo '' echo -e ""
read -sn 1 NEXT read -sn 1 NEXT
if [ "$NEXT" = q ]; then if [ "$NEXT" = q ]; then
cd "$PWD" && exit cd "$PWD" && exit
fi fi
echo -e "${LGREY}Answer:${NC} echo -e "${LGREY}Answer:${NC}
${q[2]}" ${q[2]}"
echo '' echo -e ""
echo -e "${WHITEBG}${WHITE}===========================================================${NC}" echo -e "${WHITEBG}${WHITE}===========================================================${NC}"
echo '' echo -e ""
echo -e "${LGREY}How Difficult Was This Question?${NC}" echo -e "${LGREY}How Difficult Was This Question?${NC}"
echo '' echo -e ""
echo -e "${LRED}Hard${NC} [1] ${RED}Difficult${NC} [2] ${YELLOW}Normal${NC} [3] ${GREEN}Mild${NC} [4] ${LGREEN}Easy${NC} [5]" echo -e "${LRED}Hard${NC} [1] ${RED}Difficult${NC} [2] ${YELLOW}Normal${NC} [3] ${GREEN}Mild${NC} [4] ${LGREEN}Easy${NC} [5]"
echo '' echo -e ""
read -sn 1 DIFFICULTY_SCORE read -sn 1 DIFFICULTY_SCORE
clear clear