22 lines
447 B
Plaintext
22 lines
447 B
Plaintext
|
#!/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
|