diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2016-11-15 12:08:05 +0100 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2016-11-15 12:08:05 +0100 |
commit | 780a4ca28e0de9937491b132aa0a6d93030e04d6 (patch) | |
tree | 99af359d48e9970a51e58746f312e065640e2ec1 /scripts | |
parent | 238bc21acf4c34b447335a9d33c24b18965a7009 (diff) | |
download | kyblo-780a4ca28e0de9937491b132aa0a6d93030e04d6.tar.xz |
Add publish script
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/publish | 17 |
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 "$@" |