refactor(pull request): update usage and sleep command per pull request

Add a list of supported binaries for the `-p` flag and use read instead
of sleep when falling back onto the bat.
This commit is contained in:
jsnal 2020-05-15 14:57:20 -04:00
parent 0c11309a4d
commit 8683c4d974
1 changed files with 2 additions and 2 deletions

4
flash
View File

@ -151,7 +151,7 @@ if [ ! -e "$REVIEW_LOG" ]; then
fi
print_usage() {
echo -e "\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\t${GREEN}flash -p [BINARY]:${NC} Change the previewer when selecting decks\n"
echo -e "\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\t${GREEN}flash -p [BINARY]:${NC} Change the previewer when selecting decks. Default: bat\n\t\tSupported: bat, cat\n"
}
print_info() {
@ -213,7 +213,7 @@ while [[ -z $PREVIEWER_PARAMTERS ]]; do
case $PREVIEWER in
bat) PREVIEWER_PARAMTERS="--theme='Solarized (dark)' --style=numbers --color=always" ;;
cat) PREVIEWER_PARAMTERS="--number" ;;
*) echo -e "$PREVIEWER is not a valid previewer. Use 'bat' or 'cat'. Falling back on default..." && sleep 1 && PREVIEWER='bat' ;;
*) echo -e "$PREVIEWER is not a valid previewer. Use 'bat' or 'cat'. Falling back on default..." && read -s -p 'Press [Enter] to continue...' && PREVIEWER='bat' ;;
esac
done