Skip to content

Commit efaed2c

Browse files
author
ggtrd
committed
Fix get config value
1 parent 823520f commit efaed2c

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

bashpack.sh

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -173,28 +173,12 @@ error_tarball_non_working() {
173173
# Getting values stored in configuration files
174174
# Usage: read_config_value "<file>" "<option>"
175175
get_config_value() {
176-
177176
local file=${1}
178177
local option=${2}
179178

180-
# while read -r line; do
181-
# if [[ $line =~ ^([^=]+)[[:space:]]([^=]+)$ ]]; then
182-
# # Test first word (= option name)...
183-
# if [[ $option = ${BASH_REMATCH[1]} ]]; then
184-
# # ... to get the second word (= value of the option)
185-
# echo "${BASH_REMATCH[2]}" # As this is a string, we use echo to return the value
186-
# break
187-
# fi
188-
# else
189-
# break
190-
# fi
191-
# done < "$file"
192-
193-
194179
while read -r line; do
195180
# Avoid reading comments and empty lines
196181
if [[ ${line:0:1} != "#" ]] && [[ ${line:0:1} != "" ]]; then
197-
198182
if [[ $line =~ ^([^=]+)[[:space:]]([^=]+)$ ]]; then
199183
# Test first word (= option name)...
200184
if [[ $option = ${BASH_REMATCH[1]} ]]; then
@@ -203,9 +187,8 @@ get_config_value() {
203187
break
204188
fi
205189
fi
206-
207190
fi
208-
done < "$file_config_current"
191+
done < "$file"
209192
}
210193
export -f get_config_value
211194

@@ -266,8 +249,7 @@ elif [[ $PUBLICATION = "unstable" ]]; then
266249
elif [[ $PUBLICATION = "dev" ]]; then
267250
URL="$BASE_URL/$NAME_LOWERCASE-dev"
268251
else
269-
echo "Error: repository not found."
270-
echo "Please ensure that the publication option is configured with 'main', 'unstable' or 'dev' in $dir_config/$file_config."
252+
echo "Error: publication not found. Please ensure that the publication option is configured with 'main', 'unstable' or 'dev' in $dir_config/$file_config."
271253
exit
272254
fi
273255
export URL # Export URL to be usable on tests

0 commit comments

Comments
 (0)