From 7184fb6ed0ed6b75f836450507b49290de7bdfdd Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 26 Apr 2022 23:05:06 +0800 Subject: Update --- alias | 1 + tools/wiki/diary | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/alias b/alias index 5cab1e0..0e270db 100644 --- a/alias +++ b/alias @@ -255,6 +255,7 @@ ww() { entry="${1:-guideline}"; vim ~/vimwiki/${entry%%.md}.md; } wg() { grep -r "$@" --exclude-dir=logseq/ ~/vimwiki; } wi() { cat ~/vimwiki/${1%%.md}.md; } alias dia='diary' +alias diaa='diary p' # crontab alias ce='crontab -e' diff --git a/tools/wiki/diary b/tools/wiki/diary index 06124bd..c82f040 100755 --- a/tools/wiki/diary +++ b/tools/wiki/diary @@ -19,14 +19,21 @@ pick_date() { vim -c 'Goyo' $FILE } +print_today() { + cat ~/vimwiki/diary/$(date --iso-8601).md +} + add_entry() { set -x echo - "$@" >>~/vimwiki/diary/$(date --iso-8601).md set +x } -if [ $# -eq 0 ]; then - pick_date -else - add_entry "$@" -fi +case "$1" in + "") + pick_date ;; + p) + print_today ;; + *) + add_entry "$@" ;; +esac -- cgit v1.2.3-70-g09d2