summaryrefslogtreecommitdiffstats
path: root/scripts/publish
blob: e76409e835b70662265000775e8f0be082e14c3b (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\" }]" <entries.json | sponge entries.json
}

main "$@"