diff --git a/extras/ARDUINO_IDE.sh b/extras/ARDUINO_IDE.sh index ae5dd266..8cb80d8d 100644 --- a/extras/ARDUINO_IDE.sh +++ b/extras/ARDUINO_IDE.sh @@ -19,6 +19,13 @@ # (i.e. recreates the directory tree and moves headers back to 'include'.) # ######### +# Flags +# You can skip the interface by passing '--auto'; eg 'bash ARDUINO_IDE.sh -auto' +AUTO='0' +if [ "$1" == "--auto" ]; then + AUTO='1' +fi + # Directories EXTRAS_DIR=`dirname "$0"` INCLUDE_DIR=${EXTRAS_DIR}/../src/include/cpp-client @@ -52,24 +59,26 @@ SRC_HTTP_DIR=${SRC_DIR}/http INCLUDE_HOST_DIR=${INCLUDE_DIR}/host SRC_HOST_DIR=${SRC_DIR}/host +if [[ $AUTO == '0' ]]; then + # Interface echo -e "\n\nšŸ‘‹ Welcome Aboard 🚢\n\n" sleep 1 if [[ -d ${INCLUDE_DIR} ]]; then echo -e "šŸ¤– This script extends compatibility to the Arduino IDE šŸ¤–\n" - sleep 2 + sleep 1 echo -e "šŸ’Ŗ All header files will be moved to their 'src' folders šŸ’Ŗ\n" - sleep 2 + sleep 1 else echo -e "šŸ¤– Looks like this library was already converted to support the Arduino IDE šŸ¤–\n" - sleep 2 + sleep 1 echo -e "šŸ’Ŗ All header files will be moved back to the 'include' folder šŸ’Ŗ\n" - sleep 2 + sleep 1 fi echo -e "\nšŸ›‘ These changes are permanent, any unsaved changes will be lost šŸ›‘\n" -sleep 4 +sleep 2 # Prompts for continuation read -p "āš ļø Are you sure you want to continue? (Y/n):" -n 1 -r @@ -81,12 +90,13 @@ else echo -e "\n\nšŸ‘Œ Let's go!\n"; fi +fi # /if [[ ${AUTO} ]]; then + if [[ -d ${INCLUDE_DIR} ]]; then # This will run if headers are in the 'include' directory tree. echo -e "****************************************\n" echo -e "Moving 'arkClient.h' to 'src' directory.\n" mv ${INCLUDE_DIR}/arkClient.h ${SRC_DIR} - sleep 1 echo -e "Moving API headers.\n" mv ${INCLUDE_API_DIR}/abstract.h ${SRC_API_DIR} @@ -101,30 +111,23 @@ if [[ -d ${INCLUDE_DIR} ]]; then mv ${INCLUDE_TRANSACTIONS_DIR}/transactions.h ${SRC_TRANSACTIONS_DIR} mv ${INCLUDE_VOTES_DIR}/votes.h ${SRC_VOTES_DIR} mv ${INCLUDE_WALLETS_DIR}/wallets.h ${SRC_WALLETS_DIR} - sleep 1 echo "Creating 'connection' folder šŸ—‚" mkdir ${SRC_CONNECTION_DIR} - sleep 1 + echo -e "Moving 'connection.h' to 'src/connection'.\n" mv ${INCLUDE_CONNECTION_DIR}/connection.h ${SRC_CONNECTION_DIR} - sleep 1 echo -e "Moving 'host.h'\n" mv ${INCLUDE_HOST_DIR}/host.h ${SRC_HOST_DIR} - sleep 1 echo -e "Moving 'http.h'\n" mv ${INCLUDE_HTTP_DIR}/http.h ${SRC_HTTP_DIR} - sleep 1 echo -e "Removing old directories šŸ—‘\n" rm -rf ${INCLUDE_DIR} - sleep 1 echo -e "****************************************\n" - sleep 1 - echo -e "\nAll Done!\nšŸ‘šŸ‘šŸ‘šŸ‘šŸ‘\n" echo -e "\nYou can now use Cpp-Client with the Arduino IDE šŸ‘\n\n" exit 0 @@ -132,14 +135,11 @@ if [[ -d ${INCLUDE_DIR} ]]; then else # This will run if headers are already in the 'src' directory tree. echo -e "****************************************\n" - echo -e "Creating the 'include' folder šŸ—‚\n" mkdir ${INCLUDE_DIR} - sleep 1 echo -e "Moving 'arkClient.h' back to the 'include' directory.\n" mv ${SRC_DIR}/arkClient.h ${INCLUDE_DIR} - sleep 1 echo -e "Recreating API directories šŸ—‚\n" mkdir ${INCLUDE_API_DIR} @@ -150,7 +150,6 @@ else mkdir ${INCLUDE_TRANSACTIONS_DIR} mkdir ${INCLUDE_VOTES_DIR} mkdir ${INCLUDE_WALLETS_DIR} - sleep 1 echo -e "Moving API headers back to the 'include' tree.\n" mv ${SRC_API_DIR}/abstract.h ${INCLUDE_API_DIR} @@ -165,36 +164,29 @@ else mv ${SRC_TRANSACTIONS_DIR}/transactions.h ${INCLUDE_TRANSACTIONS_DIR} mv ${SRC_VOTES_DIR}/votes.h ${INCLUDE_VOTES_DIR} mv ${SRC_WALLETS_DIR}/wallets.h ${INCLUDE_WALLETS_DIR} - sleep 1 echo -e "Recreating the 'connection' folder šŸ—‚" mkdir ${INCLUDE_CONNECTION_DIR} - sleep 1 + echo -e "Moving 'connection.h' to 'include/cpp-client/connection'.\n" mv ${SRC_CONNECTION_DIR}/connection.h ${INCLUDE_CONNECTION_DIR} - sleep 1 echo -e "Recreating the 'host' folder šŸ—‚" mkdir ${INCLUDE_HOST_DIR} - sleep 1 + echo -e "Moving 'host.h'\n" mv ${SRC_HOST_DIR}/host.h ${INCLUDE_HOST_DIR} - sleep 1 echo -e "Recreating the 'http' folder šŸ—‚" mkdir ${INCLUDE_HTTP_DIR} - sleep 1 + echo -e "Moving 'http.h'\n" mv ${SRC_HTTP_DIR}/http.h ${INCLUDE_HTTP_DIR} - sleep 1 echo -e "Removing old directories šŸ—‘\n" rm -rf ${SRC_CONNECTION_DIR} - sleep 1 echo -e "****************************************\n" - sleep 1 - echo -e "\nAll Done!\nšŸ‘šŸ‘šŸ‘šŸ‘šŸ‘\n" echo -e "\nArduino IDE compatibility has been reverted šŸ‘\n\n" exit 0