diff options
| author | Hsieh Chin Fan <typebrook@gmail.com> | 2022-04-28 22:55:30 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <typebrook@gmail.com> | 2022-04-28 22:58:12 +0800 |
| commit | 4efa36c9d5da97b2e972cbd4f9c822ee02e29a43 (patch) | |
| tree | 1243e71022c8b65bb5467b3542bdcdde84863b78 /tools/wiki | |
| parent | e4b9629a3df499cb560ec1c97bcbb8588451ea9e (diff) | |
Update
Diffstat (limited to 'tools/wiki')
| -rwxr-xr-x | tools/wiki/diary | 17 | ||||
| -rwxr-xr-x | tools/wiki/notify | 7 |
2 files changed, 17 insertions, 7 deletions
diff --git a/tools/wiki/diary b/tools/wiki/diary index 1ef77b9..aca7155 100755 --- a/tools/wiki/diary +++ b/tools/wiki/diary | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #! /bin/bash | 1 | #! /bin/bash |
| 2 | 2 | ||
| 3 | pick_date() { | 3 | today=~/vimwiki/diary/$(date --iso-8601).md |
| 4 | |||
| 5 | specify_date() { | ||
| 4 | YEAR=${YEAR:-22} | 6 | YEAR=${YEAR:-22} |
| 5 | 7 | ||
| 6 | while read -p 'Month? ' -r MONTH; do | 8 | while read -p 'Month? ' -r MONTH; do |
| @@ -20,21 +22,22 @@ pick_date() { | |||
| 20 | } | 22 | } |
| 21 | 23 | ||
| 22 | print_today() { | 24 | print_today() { |
| 23 | cat ~/vimwiki/diary/$(date --iso-8601).md | 25 | cat $today |
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | edit_today() { | 28 | edit_today() { |
| 27 | vim ~/vimwiki/diary/$(date --iso-8601).md | 29 | vim $today |
| 28 | } | 30 | } |
| 29 | 31 | ||
| 30 | add_entry() { | 32 | add_entry() { |
| 31 | echo - "$@" >>~/vimwiki/diary/$(date --iso-8601).md | 33 | [[ $# -ne 0 ]] && echo - "$@" >>$today |
| 34 | sed -E 's/\t/ /g; s/(^[[:space:]]*)/\1- /' >>$today | ||
| 32 | } | 35 | } |
| 33 | 36 | ||
| 34 | case "$1" in | 37 | case "$1" in |
| 35 | "") | 38 | specify) |
| 36 | pick_date ;; | 39 | specify_date ;; |
| 37 | p) | 40 | print) |
| 38 | print_today ;; | 41 | print_today ;; |
| 39 | today) | 42 | today) |
| 40 | edit_today ;; | 43 | edit_today ;; |
diff --git a/tools/wiki/notify b/tools/wiki/notify new file mode 100755 index 0000000..6e510d8 --- /dev/null +++ b/tools/wiki/notify | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | |||
| 3 | exec >/dev/pts/$(ls /dev/pts -t | head -1) | ||
| 4 | |||
| 5 | echo | ||
| 6 | echo | ||
| 7 | cat | ||