make setup code into function
This commit is contained in:
parent
c8391d9b25
commit
620e8474bd
4
flash
4
flash
|
|
@ -104,13 +104,15 @@ Math:What do you call a number only divisible by itself and 1?:Prime:0
|
||||||
Science:What is the distance between the Earth and Sol called?:An Astronomical Unit (AU):1
|
Science:What is the distance between the Earth and Sol called?:An Astronomical Unit (AU):1
|
||||||
Programming:Best operating system?:Arch, because BTW i run Arch:999"
|
Programming:Best operating system?:Arch, because BTW i run Arch:999"
|
||||||
|
|
||||||
|
setup(){ mkdir "$DIR" && touch "$DIR/deck.csv" && touch "$DIR/.highscore" && touch "$DIR/.reviews" && echo "$DECK_TEMPLATE" > "$EXAMPLE_DECK" && echo -e "$DIR_MADE_MSG" ;}
|
||||||
|
|
||||||
# Test if .local/share exists and wether to offer setup process
|
# Test if .local/share exists and wether to offer setup process
|
||||||
if [ ! -d "$DIR" ];then
|
if [ ! -d "$DIR" ];then
|
||||||
echo -e "No ${LRED}$DIR${NC} directory, make it? ${LGREEN}Y${NC}/${LRED}N${NC}"
|
echo -e "No ${LRED}$DIR${NC} directory, make it? ${LGREEN}Y${NC}/${LRED}N${NC}"
|
||||||
read RESPONSE
|
read RESPONSE
|
||||||
case "$RESPONSE" in
|
case "$RESPONSE" in
|
||||||
[QqNn]) exit ;;
|
[QqNn]) exit ;;
|
||||||
[Yy]) mkdir "$DIR" && touch "$DIR/deck.csv" && touch "$DIR/.highscore" && touch "$DIR/.reviews" && echo "$DECK_TEMPLATE" > "$EXAMPLE_DECK" && echo -e "$DIR_MADE_MSG" && exit ;;
|
[Yy]) setup && exit ;;
|
||||||
*) 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 ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue