knowledge-base/inc/yaml
Jonathan Hodgson ac031344d3 Splits up file into smaller files
Closes issue #9
2020-12-20 17:07:17 +00:00

24 lines
444 B
Bash

#!/usr/bin/env bash
getYamlBlock(){
vecho "getYamlBlock $*"
cd "$dataDir" || return
local filename
filename="$(findFile "$1")"
sed -n '1 { /^---/ { :a N; /\n---/! ba; p} }' "$filename" |
sed '1d;$d;s/\t/ /g'
}
getYamlTitle(){
vecho "getYamlTitle $*"
cd "$dataDir" || return
getYamlBlock "$1" | yq -r '.Title'
}
getYamlTags(){
vecho "getYamlTitle $*"
cd "$dataDir" || return
getYamlBlock "$1" | yq -r '.Tags | join("\n")'
}