apex-source-control/scripts/switch-conf-file

35 lines
830 B
Bash
Executable File

#!/bin/bash
#
# This script is designed to be called from the top level directory of your project and to be placed in the ./scripts/ directory
echo "The availible config files are:"
ls ./config/ | sed s/asc.conf// | sed -n '1!p' #print all conf files
cd config
if [ -z "${1}" ]; then
echo -n "Please enter the config file you would like to use: "
read conf_file
else
conf_file="${1}"
fi
if [ ! -e "${conf_file}" ]; then
echo "Sorry, the file ./scripts/"${conf_file}" does not exist. Either create the file using npm run new-conf-file or choose a pre-existing config file."; exit 1
fi
if [ -h asc.conf ]; then
rm asc.conf
fi
ln -s "${conf_file}" asc.conf
cd ..
echo "./config/asc.conf now points to ./config/$( readlink ./config/asc.conf )"
echo "The new config file looks like this: "
cat ./config/asc.conf