mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-22 07:16:06 +02:00
GitHub bot: fix linting issues (nobuild)
This commit is contained in:
@@ -135,26 +135,26 @@ fi
|
|||||||
# Export all yaml entries as env variables
|
# Export all yaml entries as env variables
|
||||||
# Helper function
|
# Helper function
|
||||||
function parse_yaml_to_vars {
|
function parse_yaml_to_vars {
|
||||||
local input_file=$1
|
local input_file=$1
|
||||||
local output_file=$2
|
local output_file=$2
|
||||||
|
|
||||||
# Clear the output file if it already exists
|
# Clear the output file if it already exists
|
||||||
> "$output_file"
|
>"$output_file"
|
||||||
|
|
||||||
# Process each line to escape special characters and format as needed
|
# Process each line to escape special characters and format as needed
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
# Skip lines that are empty or only contain whitespace
|
# Skip lines that are empty or only contain whitespace
|
||||||
[[ -z "$line" ]] && continue
|
[[ -z "$line" ]] && continue
|
||||||
|
|
||||||
# Replace the first occurrence of ": " with "="
|
# Replace the first occurrence of ": " with "="
|
||||||
line=${line/: /=}
|
line=${line/: /=}
|
||||||
|
|
||||||
# Escape special characters not within single quotes
|
# Escape special characters not within single quotes
|
||||||
line=$(sed -E "s/([^'])([][\$\`\"\\!&;|<>])/\1\\\\\\2/g" <<< "$line")
|
line=$(sed -E "s/([^'])([][\$\`\"\\!&;|<>])/\1\\\\\\2/g" <<<"$line")
|
||||||
|
|
||||||
# Write to output file
|
# Write to output file
|
||||||
echo "$line" >> "$output_file"
|
echo "$line" >>"$output_file"
|
||||||
done < "$input_file"
|
done <"$input_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get list of parameters in a file
|
# Get list of parameters in a file
|
||||||
|
|||||||
Reference in New Issue
Block a user