building opts capturing for version and help msg

This commit is contained in:
Bryan Jenks 2020-05-05 20:11:40 -07:00
parent d68ba42e4d
commit a0b1582aaa
1 changed files with 22 additions and 0 deletions

22
flash
View File

@ -33,10 +33,15 @@
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
LGREEN='\033[1;32m'
BLUE='\033[0;34m'
LBLUE='\033[1;34m'
CYAN='\033[0;36m'
LCYAN='\033[1;36m'
ORANGE='\033[0;33m'
LGREY='\033[0;37m'
WHITE='\033[1;37m'
NC='\033[0m' # No Color
# ANSI BACKGROUND ESCAPE COLORS
WHITEBG='\033[1;47m'
# FONT FORMAT EXCAPE CODES
@ -144,6 +149,23 @@ if [ ! -e "$REVIEW_LOG" ]; then
touch "$REVIEW_LOG"
fi
a_flag=''
b_flag=''
print_usage() {
printf "\n${LCYAN}fla.sh --- Flash card system by Bryan Jenks${NC} ${LBLUE}<BryanJenks@protonmail.com>${NC}\n\n${YELLOW}${BOLD}Usage:${NC}\n\t${GREEN}flash -h:${NC} Print this help text\n\t${GREEN}flash -i:${NC} Print Information about the flashcard system\n\t${GREEN}flash -v:${NC} Print version Number\n\n"
}
while getopts 'hiv' flag; do
case "${flag}" in
h) print_usage && exit ;;
i) a_flag='true' ;;
v) b_flag='true' ;;
*) print_usage && exit 1 ;;
esac
done
# Show pretty FZF preview of decks using BAT
DECK="$(find . -maxdepth "$SEARCH_DEPTH" -iname "*.csv" | fzf --preview='bat --theme="Solarized (dark)" --style=numbers --color=always {} | head -500')"