pyratelog

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

commit cce45103d8119bada55998c16cf484a56a8b1eba
parent a95fc7dab42d6186c1ddd2bf6e3caf6c34bb8c09
Author: pyratebeard <root@pyratebeard.net>
Date:   Fri, 21 Oct 2022 23:13:53 +0100

try to handle rnd.mov.rec entries

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}"