From 19ce0564bcd481158422c51ee0276873b3322700 Mon Sep 17 00:00:00 2001 From: Bryan Jenks Date: Mon, 25 May 2020 21:28:15 -0700 Subject: [PATCH] move function higher for no hoisting --- flash | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flash b/flash index d8e70c1..618e980 100755 --- a/flash +++ b/flash @@ -228,9 +228,8 @@ case "$CURR_DECK_DISPLAY" in *) CURRENT_DECK="$(echo "$DECK" | awk -F/ '{print $NF}')" ;; esac - +# The top part of the flash display so that code is not duplicated twice print_head(){ - echo -e "${WHITEBG} Fla.sh - Flash Cards In Your Terminal ${NC} ${ORANGE}${BOLD} Current Deck:${BOLD}${NC}\t$CURRENT_DECK ${ORANGE}${BOLD}Cards Reviewed:${BOLD}${NC}\t$COUNTER @@ -241,6 +240,17 @@ ${LGREY}Category:${NC}\n\t\t${q[0]} ${LGREY}Question:${NC}\n\t\t${q[1]}" } +# Creating new entries in the log for the average score generation +add_usage_entry(){ + if [ ! "$COUNTER" = 0 ]; then + # Create a New Entry + TIME_STAMP=$(date --rfc-3339=seconds) + REVIEWED_DECK="$(echo "$EXAMPLE_DECK" | awk -F/ '{print $7}')" + printf -v ENTRY "TimeStamp: %s Deck: %s cardsReviewed: %s" "$TIME_STAMP" "$REVIEWED_DECK" "$COUNTER" + echo "$ENTRY" >> "$REVIEW_LOG" + fi +} + # If no deck is selected in fzf menu # return user to start location # and exit quietly @@ -334,16 +344,6 @@ ${LGREY}Select a number to continue, or${NC} ${LRED}Q${NC} ${LGREY}to quit...${N } -add_usage_entry(){ - if [ ! "$COUNTER" = 0 ]; then - # Create a New Entry - TIME_STAMP=$(date --rfc-3339=seconds) - REVIEWED_DECK="$(echo "$EXAMPLE_DECK" | awk -F/ '{print $7}')" - printf -v ENTRY "TimeStamp: %s Deck: %s cardsReviewed: %s" "$TIME_STAMP" "$REVIEWED_DECK" "$COUNTER" - echo "$ENTRY" >> "$REVIEW_LOG" - fi -} - while true; do main done