feat: Enhance setup-profiles.bash
Move pre-requisites check in a separate function
This commit is contained in:
1 parent
91a4ef1c1a
commit
ae01546c0a
1 file changed
+8
-4
+8
-4
@@ -4,13 +4,15 @@ BASEDIR=$(cd "$(dirname "$0")" && pwd)
|
||||
|
||||
echo "BASEDIR=$BASEDIR"
|
||||
|
||||
# Prerequisite check for yq
|
||||
if ! command -v yq &> /dev/null
|
||||
then
|
||||
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
|
||||
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..."
|
||||
|
||||
Reference in new issue
Block a user