nixos-config/assets/etc-info/restic.sh

23 lines
548 B
Bash
Raw Normal View History

2019-10-29 16:26:53 +01:00
function only_service(){
local service=$1
cat ~/.etc_info/* | jq '.[] | select(has("'${service}'"))'
}
only_service "restic" \
| jq '.restic' | jq --slurp . | jq 'group_by(.from)' \
| jq --raw-output '
.[] |
.[0].from as $hostname |
.[0].folders as $folders |
[.[] | select(.enable) | .to.server ] as $servers |
"
# \($hostname)
## folders
\( $folders | reduce .[] as $item ( ""; . + "* " + $item + "\n" ) )
## to
\( $servers | reduce .[] as $item ( ""; . + "* " + $item + "\n") )
"' | pandoc-from-markdown-to-man | man --local-file -