refactor: move into a website directory

This commit is contained in:
Oliver Davies 2022-07-13 18:09:09 +01:00
parent 86529d7148
commit 3c5c0e808a
747 changed files with 133 additions and 2 deletions

21
website/drafts Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
set -o pipefail
readonly DRAFTS_DIR="${HOME}/Code/Personal/oliverdavies.uk/source/_posts"
if [[ $# -eq 0 ]]; then
grep -lr "draft: true" "${DRAFTS_DIR}" | cut -d"/" -f9- | tr ".md" "" | sort
exit 0
fi
readonly DRAFTS_FILE="${*}.md"
readonly DRAFTS_PATH="${DRAFTS_DIR}/${DRAFTS_FILE// /-}"
echo $DRAFTS_PATH
if [[ -e "${DRAFTS_PATH}" ]]; then
eval "${EDITOR}" "${DRAFTS_PATH}"
else
touch "${DRAFTS_PATH}"
fi