add exit code numbers
This commit is contained in:
parent
58e6c296ad
commit
ae3158e30e
22
flash
22
flash
|
|
@ -125,19 +125,19 @@ if [ ! -d "$DIR" ];then
|
||||||
# shellcheck disable=SC2162
|
# shellcheck disable=SC2162
|
||||||
read RESPONSE
|
read RESPONSE
|
||||||
case "$RESPONSE" in
|
case "$RESPONSE" in
|
||||||
[QqNn]) exit ;;
|
[QqNn]) exit 0 ;;
|
||||||
[Yy]) setup && exit ;;
|
[Yy]) setup && exit 0 ;;
|
||||||
*) echo -e "invalid choice, please select either ${LGREEN}y${NC} or ${LRED}n${NC}" && exit ;;
|
*) echo -e "invalid choice, please select either ${LGREEN}y${NC} or ${LRED}n${NC}" && exit 1 ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# go to the flashcard decks directory
|
# go to the flashcard decks directory
|
||||||
cd "$DIR" || exit
|
cd "$DIR" || exit 1
|
||||||
|
|
||||||
# If there are no flashcard decks available return user to starting location
|
# If there are no flashcard decks available return user to starting location
|
||||||
# while also displaying explanatory text of issue
|
# while also displaying explanatory text of issue
|
||||||
if [ "$(find . -maxdepth "$SEARCH_DEPTH" -iname "*.csv" | wc -l)" = 0 ]; then
|
if [ "$(find . -maxdepth "$SEARCH_DEPTH" -iname "*.csv" | wc -l)" = 0 ]; then
|
||||||
echo -e "$NO_DECKS" && cd "$PWD" && exit
|
echo -e "$NO_DECKS" && cd "$PWD" && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if highscore file was removed, remake it.
|
# if highscore file was removed, remake it.
|
||||||
|
|
@ -199,9 +199,9 @@ ${LCYAN}The Scoring System:${NC}\n
|
||||||
|
|
||||||
while getopts 'hivp:' flag; do
|
while getopts 'hivp:' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
h) print_usage && exit ;;
|
h) print_usage && exit 0 ;;
|
||||||
i) print_info && exit ;;
|
i) print_info && exit 0 ;;
|
||||||
v) echo -e "\n${YELLOW}fla.sh Current Version:${NC} ${RED}1.1${NC}\n" && exit ;;
|
v) echo -e "\n${YELLOW}fla.sh Current Version:${NC} ${RED}1.1${NC}\n" && exit 0 ;;
|
||||||
p) if [[ $(command -v "$OPTARG" 2>&1) ]]; then PREVIEWER=$OPTARG; else echo "Unable to find previewer $OPTARG. Exiting..." && exit 1; fi ;;
|
p) if [[ $(command -v "$OPTARG" 2>&1) ]]; then PREVIEWER=$OPTARG; else echo "Unable to find previewer $OPTARG. Exiting..." && exit 1; fi ;;
|
||||||
*) print_usage && exit 1 ;;
|
*) print_usage && exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -224,7 +224,7 @@ done
|
||||||
# return user to start location
|
# return user to start location
|
||||||
# and exit quietly
|
# and exit quietly
|
||||||
if [ -z "$DECK" ]; then
|
if [ -z "$DECK" ]; then
|
||||||
cd "$PWD" && exit
|
clear && cd "$PWD" && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
main(){
|
main(){
|
||||||
|
|
@ -258,7 +258,7 @@ ${LGREY}Category:${NC}\n\t\t${q[0]}
|
||||||
${LGREY}Question:${NC}\n\t\t${q[1]}
|
${LGREY}Question:${NC}\n\t\t${q[1]}
|
||||||
"
|
"
|
||||||
if [ "$NEXT" = q ] || [ "$NEXT" = Q ]; then
|
if [ "$NEXT" = q ] || [ "$NEXT" = Q ]; then
|
||||||
add_usage_entry && cd "$PWD" && clear && exit
|
add_usage_entry && cd "$PWD" && clear && exit 0
|
||||||
fi
|
fi
|
||||||
echo -e "${LGREY}Answer:${NC}\n\t\t${q[2]}
|
echo -e "${LGREY}Answer:${NC}\n\t\t${q[2]}
|
||||||
|
|
||||||
|
|
@ -276,7 +276,7 @@ ${LGREY}Select a number to continue, or${NC} ${LRED}Q${NC} ${LGREY}to quit...${N
|
||||||
read -sn 1 DIFFICULTY_SCORE
|
read -sn 1 DIFFICULTY_SCORE
|
||||||
done
|
done
|
||||||
if [ "$DIFFICULTY_SCORE" = q ] || [ "$DIFFICULTY_SCORE" = Q ]; then
|
if [ "$DIFFICULTY_SCORE" = q ] || [ "$DIFFICULTY_SCORE" = Q ]; then
|
||||||
add_usage_entry && cd "$PWD" && clear && exit
|
add_usage_entry && cd "$PWD" && clear && exit 0
|
||||||
fi
|
fi
|
||||||
clear
|
clear
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue