Skip to content

Commit c70a39e

Browse files
committed
add bin/publish-post utility
1 parent 8abb773 commit c70a39e

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ paginate_path: /blog/page:num
99
include:
1010
- _s
1111
exclude:
12+
- bin
1213
- Phakefile.php
1314
- README.md

bin/publish-post

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
if [ $# -lt 1 ]; then
4+
echo "usage: $0 _drafts/<path-to-file> [<new-slug>]"
5+
exit 1
6+
fi
7+
8+
if [ ! -f $1 ]; then
9+
echo "draft not found: $1"
10+
exit 1
11+
fi
12+
13+
if [ $# -gt 1 ]; then
14+
fname="$2".md
15+
else
16+
fname=${1/_drafts\//}
17+
fi
18+
19+
mv $1 _posts/$(date +'%F')-$fname

0 commit comments

Comments
 (0)