From 780a4ca28e0de9937491b132aa0a6d93030e04d6 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Tue, 15 Nov 2016 12:08:05 +0100 Subject: Add publish script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- scripts/publish | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scripts/publish (limited to 'scripts') 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\" }]"