yasuoza diary

web and life

octpress rake new_post wrapper command

Save following content as new-post.

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
27
28
29
30
#!/usr/bin/env bash

function create () {
  local title=$@
  rake new_post["$title"]
}

function usage() {
  echo "USAGE"
  echo "    new-post 'This is my new post'"
}


if [[ -z $1 ]]; then
  usage
  exit 1
fi

while [ "$1" != "" ]; do
      arg=$1
    case "$arg" in
        -h | --help ) usage
                      exit
                      ;;
        * )           create ${arg[@]}
                      exit
                      ;;
    esac
    shift
done

With above command, you can start writing new post via

1
$ new-post 'This is my super entry'

sunglassessunglassessunglasses

Comments