mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 05:31:53 +00:00
28 lines
620 B
Bash
Executable File
28 lines
620 B
Bash
Executable File
#!/bin/zsh
|
|
|
|
label_re='^([a-z0-9\_-]*)(\)|\|\\)$'
|
|
endlabel_re='^( |\t);;$'
|
|
|
|
label_dir="fragments/labels"
|
|
|
|
IFS=$'\n'
|
|
|
|
in_label=0
|
|
current_label=""
|
|
while read -r line; do
|
|
if [[ $in_label -eq 0 && "$line" =~ $label_re ]]; then
|
|
label_name=${match[1]}
|
|
echo "found label $label_name"
|
|
in_label=1
|
|
fi
|
|
if [[ $in_label -eq 1 ]]; then
|
|
current_label=$current_label$'\n'$line
|
|
fi
|
|
if [[ $in_label -eq 1 && "$line" =~ $endlabel_re ]]; then
|
|
echo $current_label > "$label_dir/${label_name}.txt"
|
|
in_label=0
|
|
current_label=""
|
|
fi
|
|
|
|
done <./Installomator.sh
|