Merge subcommand for k/v files
This commit is contained in:
parent
cd63d6d236
commit
83a2f25c15
22
shchemes
22
shchemes
@ -170,6 +170,24 @@ ENDFILE {
|
|||||||
' "$path" > "$tmp" && mv "$tmp" "$path"
|
' "$path" > "$tmp" && mv "$tmp" "$path"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO: multiple format support, check that line actually has multiple fields
|
||||||
|
merge() {
|
||||||
|
path=$1
|
||||||
|
tmp=$(mktemp)
|
||||||
|
|
||||||
|
awk -F "=" '
|
||||||
|
FILENAME == "-" {
|
||||||
|
a[$1] = $2
|
||||||
|
next
|
||||||
|
}
|
||||||
|
a[$1] {
|
||||||
|
print $1 "=" a[$1]
|
||||||
|
next
|
||||||
|
}
|
||||||
|
{ print }
|
||||||
|
' - "$path" > "$tmp" && mv "$tmp" "$path"
|
||||||
|
}
|
||||||
|
|
||||||
convert_tinted_scheme() {
|
convert_tinted_scheme() {
|
||||||
path=$1
|
path=$1
|
||||||
tmp=$(mktemp)
|
tmp=$(mktemp)
|
||||||
@ -247,6 +265,10 @@ if [ "$method" != "" ]; then
|
|||||||
inject "${args[1]}" "${args[2]}"
|
inject "${args[1]}" "${args[2]}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
merge)
|
||||||
|
merge "${args[1]}" "${args[2]}"
|
||||||
|
;;
|
||||||
|
|
||||||
convert_tinted_template)
|
convert_tinted_template)
|
||||||
convert_tinted_template "${args[1]}"
|
convert_tinted_template "${args[1]}"
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user