summary refs log tree commit diff stats
path: root/new/post
diff options
context:
space:
mode:
Diffstat (limited to 'new/post')
-rwxr-xr-xnew/post37
1 files changed, 37 insertions, 0 deletions
diff --git a/new/post b/new/post new file mode 100755 index 0000000..48e4549 --- /dev/null +++ b/new/post
@@ -0,0 +1,37 @@
1#!/bin/sh
2
3usage() {
4 cat >&2 <<EOF
5$0: make a new post
6Usage: $0 [OPTIONS...] [TITLE...]
7Options:
8 -h Show this help and exit
9 -n Don't edit the post
10 -F FILE
11 Instead of using TITLE as the post's title, use it as a filename to read
12 into the post.
13Parameters:
14 TITLE...
15 The title of the post (its first line)
16EOF
17}
18
19main() {
20 startoff='--message="$*"'
21 edit='--edit'
22 while getopts hF:n OPT
23 do
24 case "$OPT" in
25 (h) usage 0 ;;
26 (F) startoff='--file="$*"' ;;
27 (n) edit='--no-edit' ;;
28 (*) usage 1 ;;
29 esac
30 done
31 shift $((OPTIND - 1))
32
33 git add .
34 eval git commit --allow-empty --no-status $startoff $edit
35}
36
37main "$@"