Skip to content

Instantly share code, notes, and snippets.

@grantmacken
Last active March 13, 2021 21:36
Show Gist options
  • Save grantmacken/4a80f565612fcd6d0eb5 to your computer and use it in GitHub Desktop.
Save grantmacken/4a80f565612fcd6d0eb5 to your computer and use it in GitHub Desktop.
extract front-matter from a markdown file into vars
---
ISSUE_DATE=2015-01-14
ISSUE_LABEL="enhancement"
ISSUE_TITLE="branch selection from issue"
ISSUE_STATE="open"
ISSUE_NUMBER=2
---
A one line *summary* of what we hope to resolve.
- [x] todo task 1
- [ ] todo task 2
- [ ] todo ...
enhancement #2 branch selection from issue
#!/bin/bash
file='issue.txt'
source <(cat << EOF
$( sed -n '1,/---/p' ${file} | sed '1d;$d' )
EOF
)
echo " *ISSUE_DATE*: [ ${ISSUE_DATE} ]"
echo " *ISSUE_TITLE*: [ ${ISSUE_TITLE} ]"
echo " *ISSUE_LABEL*: [ ${ISSUE_LABEL} ]"
echo " *ISSUE_NUMBER*: [ ${ISSUE_NUMBER} ]"
echo " *ISSUE_STATE*: [ ${ISSUE_STATE} ]"
@grantmacken
Copy link
Author

view issue.md in the raw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment