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., .)@}