From 6fae25b305d714b3ab7608fa003f1af9bf024545 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 14 Feb 2023 13:33:23 +0800 Subject: Rename tools into bin --- tools/wiki/diary | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100755 tools/wiki/diary (limited to 'tools/wiki/diary') diff --git a/tools/wiki/diary b/tools/wiki/diary deleted file mode 100755 index 3995ecf..0000000 --- a/tools/wiki/diary +++ /dev/null @@ -1,49 +0,0 @@ -#! /bin/bash - -today=~/log/`date +%y.w%W.md` - -specify_date() { - YEAR=${YEAR:-22} - - while read -e -p 'Month? ' -r MONTH /dev/null && break - done - - while read -e -p 'Day? ' -r DAY /dev/null && break - done - - FILE=~/log/diary/20$YEAR-$MONTH-$DAY.md - vim -c 'Goyo' $FILE -} - -print_today() { - [[ ! -e $today ]] && touch $today - cat $today -} - -edit_today() { - vim -c Goyo $today -} - -add_entry() { - [[ $# -ne 0 ]] && echo - "$@" >>$today - while read -e -r entry; do - echo $entry | sed -E 's/\t/ /g; s/(^[[:space:]]*)/\1- /' >>$today - done -} - -case "$1" in - specify) - specify_date ;; - print) - print_today ;; - today) - edit_today ;; - *) - add_entry "$@" ;; -esac -- cgit v1.2.3-70-g09d2