Build works for sure in FreeBSD now, upload may have a problem still
This commit is contained in:
@@ -38,8 +38,29 @@ toml_get() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toml_array() {
|
toml_array() {
|
||||||
(grep "^$1 " "$CONFIG" 2>/dev/null || true) | head -1 \
|
# Handles both single-line: key = ["a", "b"]
|
||||||
| sed 's/.*\[//; s/\].*//; s/"//g; s/,/ /g' | tr -s ' '
|
# and multiline: key = [
|
||||||
|
# "a",
|
||||||
|
# "b",
|
||||||
|
# ]
|
||||||
|
awk -v key="$1" '
|
||||||
|
$0 ~ ("^" key " *= *\\[") {
|
||||||
|
collecting = 1
|
||||||
|
buf = $0
|
||||||
|
if (index($0, "]") > 0) { collecting = 0 }
|
||||||
|
}
|
||||||
|
collecting && NR > 1 { buf = buf " " $0 }
|
||||||
|
collecting && index($0, "]") > 0 && NR > 1 { collecting = 0 }
|
||||||
|
!collecting && buf != "" {
|
||||||
|
gsub(/.*\[/, "", buf)
|
||||||
|
gsub(/\].*/, "", buf)
|
||||||
|
gsub(/"/, "", buf)
|
||||||
|
gsub(/,/, " ", buf)
|
||||||
|
print buf
|
||||||
|
buf = ""
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
' "$CONFIG" | tr -s " "
|
||||||
}
|
}
|
||||||
|
|
||||||
toml_section_get() {
|
toml_section_get() {
|
||||||
|
|||||||
@@ -39,8 +39,29 @@ toml_get() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toml_array() {
|
toml_array() {
|
||||||
(grep "^$1 " "$CONFIG" 2>/dev/null || true) | head -1 \
|
# Handles both single-line: key = ["a", "b"]
|
||||||
| sed 's/.*\[//; s/\].*//; s/"//g; s/,/ /g' | tr -s ' '
|
# and multiline: key = [
|
||||||
|
# "a",
|
||||||
|
# "b",
|
||||||
|
# ]
|
||||||
|
awk -v key="$1" '
|
||||||
|
$0 ~ ("^" key " *= *\\[") {
|
||||||
|
collecting = 1
|
||||||
|
buf = $0
|
||||||
|
if (index($0, "]") > 0) { collecting = 0 }
|
||||||
|
}
|
||||||
|
collecting && NR > 1 { buf = buf " " $0 }
|
||||||
|
collecting && index($0, "]") > 0 && NR > 1 { collecting = 0 }
|
||||||
|
!collecting && buf != "" {
|
||||||
|
gsub(/.*\[/, "", buf)
|
||||||
|
gsub(/\].*/, "", buf)
|
||||||
|
gsub(/"/, "", buf)
|
||||||
|
gsub(/,/, " ", buf)
|
||||||
|
print buf
|
||||||
|
buf = ""
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
' "$CONFIG" | tr -s " "
|
||||||
}
|
}
|
||||||
|
|
||||||
toml_section_get() {
|
toml_section_get() {
|
||||||
|
|||||||
Reference in New Issue
Block a user