From be86ab3ac72eca51ceed8f7bd1f09ac7cd25865f Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Thu, 2 Jun 2022 22:03:23 -0700 Subject: [PATCH] Archetypes and automation for composing notes Create a shell script for composing a note/reply more quickly, including launching the default $EDITOR --- archetypes/default.md | 2 +- archetypes/reply.md | 10 +++++++ scripts/bin/hugo-new-note | 58 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 archetypes/reply.md create mode 100755 scripts/bin/hugo-new-note diff --git a/archetypes/default.md b/archetypes/default.md index 00e77bd..3d13579 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,5 +1,5 @@ --- -title: "{{ replace .Name "-" " " | title }}" +title: "{{ .Name | humanize }}" date: {{ .Date }} draft: true --- diff --git a/archetypes/reply.md b/archetypes/reply.md new file mode 100644 index 0000000..bc0177c --- /dev/null +++ b/archetypes/reply.md @@ -0,0 +1,10 @@ +--- +title: "{{ .Name | humanize }}" +date: {{ .Date }} +replyURI: "" +replyTitle: "" +replyType: "" +replyAuthor: "" +replyAuthorURI: "" +--- + diff --git a/scripts/bin/hugo-new-note b/scripts/bin/hugo-new-note new file mode 100755 index 0000000..945dea7 --- /dev/null +++ b/scripts/bin/hugo-new-note @@ -0,0 +1,58 @@ +#!/usr/bin/env dash + +set -e -u + +# the name of this program +progname="$(basename "${0}")" + +help_text="Usage: ${progname} [OPTION...] FILENAME + +Compose a new note + +Options: + -h Print this help and exit + -r Whether this note should be a reply +" + +usage() { + printf '%s' "${help_text}" +} + +# when the user passess bad args, send a msg to stderr and exit +# usage: bad_option