feat: Enhance setup-profiles.bash

Move pre-requisites check in a separate function
This commit is contained in:
xavier committed 2025-07-13 00:06:13 +02:00
1 parent 91a4ef1c1a
commit ae01546c0a
1 file changed
+12 -8
+12 -8
View File
@@ -4,13 +4,15 @@ BASEDIR=$(cd "$(dirname "$0")" && pwd)
echo "BASEDIR=$BASEDIR"
# Prerequisite check for yq
if ! command -v yq &> /dev/null
then
echo "Error: yq is not installed."
echo "Please install yq to use this script. Refer to https://github.com/mikefarah/yq#install for installation methods."
exit 1
fi
check_prerequisites() {
# Prerequisite check for yq
if ! command -v yq &> /dev/null
then
echo "Error: yq is not installed."
echo "Please install yq to use this script. Refer to https://github.com/mikefarah/yq#install for installation methods."
exit 1
fi
}
update_profile() {
local profile_file="$1"
@@ -35,6 +37,8 @@ update_profile() {
cd "$BASEDIR" || exit
check_prerequisites
if [ "$#" -eq 0 ]; then
# No arguments, update all profiles
echo "No profile specified, updating all profiles..."
@@ -50,4 +54,4 @@ else
echo "Error: Profile file '$file_path' not found. Skipping."
fi
done
fi
fi