Add support for acitvating/deactivating multiple mods at once.

This commit is contained in:
Daniel Ceregatti 2023-10-15 11:25:38 -07:00
parent b0596f5e11
commit a3f062799c

View file

@ -336,19 +336,25 @@ config(){
# Activate / Deactivate a mod
activate(){
# W(hich?) a or d
W=${1}
# Pop that off so we can loop over the rest
shift
# Default values are when activating
WW=""
COLOR="${green}"
if [[ ${W} = 0 ]]
then
# Deactivating instead
WW="de"
COLOR="${red}"
fi
ID=$(get_mod_id ${1} ${W})
# Loop over the rest of the argument(s)
for i in ${@}
do
# Get the mod id and name
ID=$(get_mod_id ${i} ${W})
MODNAME=$(get_mod_name ${ID})
# echo "ID: ${ID}, MODNAME: ${MODNAME}"
# exit 0
# Toggle state or report nothing burger
pushd "${SERVER_PROFILE}" > /dev/null
if [[ ${W} = 0 ]] && [ -L "${SERVER_PROFILE}/@${MODNAME}" ]
@ -365,6 +371,7 @@ activate(){
copy_keys ${W} ${ID}
echo -e "Mod id ${ID} - ${COLOR}${MODNAME}${default} ${WW}activated"
popd > /dev/null
done
status
}
@ -469,6 +476,7 @@ backup(){
mkdir -p ${B} 1> /dev/null
cp -a "${i}" "${B}"
done
cp -a /profiles ${B}
}
MAP=$(get_map_name)