aboutsummaryrefslogtreecommitdiff
path: root/bin/new
blob: e6d176c0e0841791a9345644cb8eecbe4b23ba2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

#
# generate new content
#
# Examples:
#   # create new post with slug "great-news" and title "Great News"
#   bin/new post great-news
#
#   # create new article with slug "some-stuff" and title "Some Stuff"
#   bin/new article some-stuff
#
#   # create new project with slug "cool-app" and title "Cool App"
#   bin/new project cool-app
#

if [ "$1" = 'post' ]; then
  DATE=$(date +%Y-%m-%d)
  exec hugo new --editor $EDITOR posts/"$DATE"-"$2".md
elif [ "$1" = 'project' ]; then
  exec hugo new --editor $EDITOR projects/"$2".md
elif [ "$1" = 'article' ]; then
  exec hugo new --editor $EDITOR articles/"$2".md
else
  echo "unknown type: $1"
fi