summaryrefslogtreecommitdiffstats
path: root/scripts/publish
blob: dc192113d2d9e19bab102d22109fd71da202db0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

main() {
	if (( $# != 2 )); then
		printf 'Invalid number of parameters: %d\n' "$#"
		exit 1
	fi

	local file="$1"
	local title="$2"
	local date="$(date -Id)"

	mv "$file" entries/"$file"
	jq "[.[], { title: \"$title\", date: \"$date\", file: \"${file%.rst}\" }]" <metadata.json | sponge metadata.json
}

main "$@"