mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 05:31:53 +00:00
created a utils directory
This commit is contained in:
27
utils/extractLabels.sh
Normal file
27
utils/extractLabels.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user