pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

commit 021f55ae2f14d285ab5b7f45872c095e98f2205a
parent f506a5ee7f05a2c9fcb81be3eb13ea4e83d58eea
Author: pyratebeard <root@pyratebeard.net>
Date:   Tue, 25 Oct 2022 21:00:14 +0100

Merge branch 'make'

Diffstat:
MMakefile | 3++-
Mscripts/draft | 18++++++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,4 +1,5 @@ #TITLE := $(shell git branch --show-current) +RND := "" # https://stackoverflow.com/a/14061796 # If the first argument is "draft" ifeq (draft,$(firstword $(MAKECMDGOALS))) @@ -34,7 +35,7 @@ prog: # ... .PHONY: draft preview publish draft : prog - scripts/draft $(DRAFT_ARGS) + scripts/draft $(DRAFT_ARGS) $(RND) preview : prog scripts/preview $(VIEW_ARGS) diff --git a/scripts/draft b/scripts/draft @@ -2,12 +2,22 @@ # use arg as title and set post file path TITLE=$1 -POST="entry/${TITLE}.md" +RND=$2 + +if [ "$RND" = "mov" ] ; then + POST="entry/rnd.mov.rec:_${TITLE}.md" +else + POST="entry/${TITLE}.md" +fi # checkout the correct branch -git branch | grep ${TITLE} && \ - git checkout -q ${TITLE} || \ - $(git checkout -q main && git checkout -q -b ${TITLE}) || exit 1 +if [ "$RND" = "mov" ] ; then + git checkout -q rnd.mov.rec +else + git branch | grep ${TITLE} && \ + git checkout -q ${TITLE} || \ + $(git checkout -q main && git checkout -q -b ${TITLE}) || exit 1 +fi # if post file does not exist yet touch it [ -f "${POST}" ] || touch "${POST}"