#!/usr/bin/zsh
source ~/skami/sh/autosource/00-util.sh

echo "Which cat?"
ls ~/skami/jeknix/texts/
read tag
mkdir -p ~/skami/jeknix/texts/${tag}/_posts/

{ echo ---
  echo title: '"'$(grep -m1 ^.\  "$1"|cut -c3-)'"'
  echo date: $(date --rfc-3339='ns'|sed 's/\..*+\(..\):/ +\1/')
  echo ---
  echo "{% include_absolute '$(realpath "$1")' %}"
} > ~/skami/jeknix/texts/${tag}/_posts/\
$(date +%Y-%m-%d)-"$(realpath "$1"|sed 's!.*/\([^/]*\)/'"$(echo "$1" | sed 's!.*/!!')"'!\1.md!')"
