move function higher for no hoisting

This commit is contained in:
Bryan Jenks 2020-05-25 21:28:15 -07:00
parent 511e721456
commit 19ce0564bc
1 changed files with 12 additions and 12 deletions

24
flash
View File

@ -228,9 +228,8 @@ case "$CURR_DECK_DISPLAY" in
*) CURRENT_DECK="$(echo "$DECK" | awk -F/ '{print $NF}')" ;; *) CURRENT_DECK="$(echo "$DECK" | awk -F/ '{print $NF}')" ;;
esac esac
# The top part of the flash display so that code is not duplicated twice
print_head(){ print_head(){
echo -e "${WHITEBG} Fla.sh - Flash Cards In Your Terminal ${NC} echo -e "${WHITEBG} Fla.sh - Flash Cards In Your Terminal ${NC}
${ORANGE}${BOLD} Current Deck:${BOLD}${NC}\t$CURRENT_DECK ${ORANGE}${BOLD} Current Deck:${BOLD}${NC}\t$CURRENT_DECK
${ORANGE}${BOLD}Cards Reviewed:${BOLD}${NC}\t$COUNTER ${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]}" ${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 # If no deck is selected in fzf menu
# return user to start location # return user to start location
# and exit quietly # 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 while true; do
main main
done done