aboutsummaryrefslogtreecommitdiff
path: root/scripts/meta
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-04-01 12:47:12 +0200
committerlonkaars <l.leblansch@gmail.com>2021-04-01 12:47:12 +0200
commit5a9da62ded70cfb05309aebcb1c1ee09d17948c5 (patch)
tree0ddbdff0a75279bd6d4dae48fe83510cb5e32108 /scripts/meta
parent71ab18ec4264197aae27efe64e4565c4989a19cd (diff)
added scripts for post meta json things
Diffstat (limited to 'scripts/meta')
-rwxr-xr-xscripts/meta18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/meta b/scripts/meta
new file mode 100755
index 0000000..f33ea3d
--- /dev/null
+++ b/scripts/meta
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+tag_name=$1
+filename=$2
+
+output=$(grep -Poh "^\[meta\]:\s+<$tag_name>\s+\(\K(.+)(?=\)$)" $filename)
+
+if [[ $tag_name = "tags" ]]; then
+ echo $output |\
+ sed "s/,\s*/\n/g" |\
+ sed -z '$ s/\n$//' |\
+ jq --raw-input --slurp 'split("\n")'
+else
+ echo $output |\
+ sed -z '$ s/\n$//' |\
+ jq --raw-input
+fi
+