blob: eeed7a36909508edbe5c59aa4be3876e6008c92b (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#!/bin/sh
set -e
if [ "$#" != 1 ]
then
echo "Usage: $0 title"
exit 1
fi
title="$1"
temp="$(mktemp)"
cat << eof > "$temp"
[[!meta title="$title"]]
[[!tag ]]
[[!meta date="$(date +%Y-%m-%dT%H:%M)"]]
eof
checksum="$(mktemp)"
md5sum "$temp" > "$checksum"
vi "$temp"
if md5sum --status -c "$checksum"
then
echo "No change to note, aborting."
rm "$temp" "$checksum"
exit 1
fi
cat << eof >> "$temp"
[[!meta done="$(date +%Y-%m-%dT%H:%M)"]]
eof
cd "$HOME/Journal/src"
filename="notes/$(date +%Y-%m-%d-%H:%M.mdwn)"
if [ -e "$filename" ]
then
filename="notes/$(date +%Y-%m-%d-%H:%M:%S.mdwn)"
fi
cp "$temp" "$filename"
bzr add "$filename"
bzr commit -m "New note" "$filename"
ikiwiki --setup ../ikiwiki.setup --refresh
rm "$temp" "$checksum"
|