@@ -19,6 +19,10 @@ logHappy() {
1919 echo " \033[32m✔\033[0m $1 "
2020}
2121
22+ logWarning () {
23+ echo " \033[93m⚠\033[0m $1 "
24+ }
25+
2226checkDependency () {
2327 if ! [ -x " $( command -v $1 ) " ]; then
2428 throwError " Missing dependency: I could not find the executable '$1 '"
@@ -113,13 +117,32 @@ cd "$AGDA_DIR"
113117mkdir -p logs
114118
115119# Downloading and extracting the standard library
116- STDLIB_TARBALL_NAME=" /tmp/agda-stdlib-$STDLIB_VERSION .tar.gz"
120+ STDLIB_DIR_NAME=" agda-stdlib-$STDLIB_VERSION "
121+ STDLIB_TARBALL_NAME=" /tmp/$STDLIB_DIR_NAME .tar.gz"
117122STDLIB_TARBALL_URL=" https://github.com/agda/agda-stdlib/archive/$STDLIB_TAG .tar.gz"
118123wget -O " $STDLIB_TARBALL_NAME " " $STDLIB_TARBALL_URL " -o logs/wget
119- tar -zxvf " $STDLIB_TARBALL_NAME " > logs/tar
120124
121125logHappy " Successfully downloaded the standard library"
122126
127+ if [ -d " $STDLIB_DIR_NAME " ]; then
128+ logWarning " The directory $AGDA_DIR /$STDLIB_DIR_NAME already exists."
129+ while true ; do
130+ read -p " Do you want to overwrite it? (yN) " DIR_OVERWRITE
131+ DIR_OVERWRITE=${DIR_OVERWRITE:- n}
132+ case " $DIR_OVERWRITE " in
133+ [yY]* ) DIR_OVERWRITE=" y" ; break ;;
134+ [nN]* ) DIR_OVERWRITE=" n" ; break ;;
135+ * ) echo " Please answer y or n." ;;
136+ esac
137+ done
138+ if [ " $DIR_OVERWRITE " = " y" ]; then
139+ rm -rf " $STDLIB_DIR_NAME "
140+ tar -zxvf " $STDLIB_TARBALL_NAME " > logs/tar
141+ fi
142+ else
143+ tar -zxvf " $STDLIB_TARBALL_NAME " > logs/tar
144+ fi
145+
123146# Adding the standard library to the list of installed and default libraries
124147STDLIB_PATH=" $AGDA_DIR /agda-stdlib-$STDLIB_VERSION /standard-library.agda-lib"
125148AGDA_LIBRARIES_FILE=" libraries-$AGDA_VERSION "
0 commit comments