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
+4
+4
View File
@@ -4,6 +4,7 @@ BASEDIR=$(cd "$(dirname "$0")" && pwd)
echo "BASEDIR=$BASEDIR" echo "BASEDIR=$BASEDIR"
check_prerequisites() {
# Prerequisite check for yq # Prerequisite check for yq
if ! command -v yq &> /dev/null if ! command -v yq &> /dev/null
then then
@@ -11,6 +12,7 @@ then
echo "Please install yq to use this script. Refer to https://github.com/mikefarah/yq#install for installation methods." echo "Please install yq to use this script. Refer to https://github.com/mikefarah/yq#install for installation methods."
exit 1 exit 1
fi fi
}
update_profile() { update_profile() {
local profile_file="$1" local profile_file="$1"
@@ -35,6 +37,8 @@ update_profile() {
cd "$BASEDIR" || exit cd "$BASEDIR" || exit
check_prerequisites
if [ "$#" -eq 0 ]; then if [ "$#" -eq 0 ]; then
# No arguments, update all profiles # No arguments, update all profiles
echo "No profile specified, updating all profiles..." echo "No profile specified, updating all profiles..."