From b44e1b45b004f7eff08f802ae4e63990d28cd5d6 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Thu, 3 Apr 2025 15:22:37 -0400 Subject: [PATCH] feat: Updates to justfile to generate new articles and find the latest article. --- justfile | 13 +++++++++++-- scripts/join-tags.sh | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 scripts/join-tags.sh diff --git a/justfile b/justfile index 39340f4..c3b0750 100644 --- a/justfile +++ b/justfile @@ -12,12 +12,21 @@ default: run: @swift run watch content Sources deploy -new-article name: - @touch {{articles}}/{{shortdate}}-{{name}}.md +# Create a new article with given name and tags. +new-article name *tags: + @echo "---" > {{articles}}/{{shortdate}}-{{name}}.md + @echo "date: {{shortdate}}" >> {{articles}}/{{shortdate}}-{{name}}.md + @echo "tags: `./scripts/join-tags.sh {{tags}}`" >> {{articles}}/{{shortdate}}-{{name}}.md + @echo "---" >> {{articles}}/{{shortdate}}-{{name}}.md @echo {{articles}}/{{shortdate}}-{{name}}.md alias n := new-article +latest-article: + @echo "$(find {{articles}} -maxdepth 1 -mindepth 1 -type f | sort -nr | head -1)" + +alias l := latest-article + [group('dev')] build: @docker build --tag {{docker_image}}:{{docker_tag}} . diff --git a/scripts/join-tags.sh b/scripts/join-tags.sh new file mode 100755 index 0000000..48500de --- /dev/null +++ b/scripts/join-tags.sh @@ -0,0 +1,3 @@ +#!/bin/zsh + +echo ${(j., .)@}