summaryrefslogtreecommitdiffstats
path: root/scripts/publish
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/publish')
-rwxr-xr-xscripts/publish17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/publish b/scripts/publish
new file mode 100755
index 0000000..e76409e
--- /dev/null
+++ b/scripts/publish
@@ -0,0 +1,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 "$@"