From 749bf9e0577478ddf0e062d9ff36e2e6d91bd14d Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Sun, 21 Nov 2021 20:59:08 +0100 Subject: [PATCH] new daily_finder without the ability to create notes - done by the plugin --- ext_commands/daily_finder.sh | 39 +++--------------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/ext_commands/daily_finder.sh b/ext_commands/daily_finder.sh index 2f4a701..05c89dd 100755 --- a/ext_commands/daily_finder.sh +++ b/ext_commands/daily_finder.sh @@ -2,16 +2,13 @@ # daily_finder for telekasten.nvim # -# gives the plugin the ability to search for daily notes, -# - sorted by date -# - creates today's note if not present, with hardcoded template +# actually, this is now the standard finder in telekasten if [ "$1" == "check" ] ; then echo OK exit 0 fi - # if called by the plugin, no args are provided, and the current working # directory is set instead if [ "$1" == "" ] ; then @@ -20,35 +17,5 @@ else the_dir=$1 fi -# function DaySuffix: -# little helper to give us st, nd, th for 1st, 2nd, 3rd, 4th, ... -DaySuffix() { - case `date +%d` in - 1|21|31) echo "st";; - 2|22) echo "nd";; - 3|23) echo "rd";; - *) echo "th";; - esac -} - -# path to today's note -dailyfile=$the_dir/$(date --iso).md - -# function CreateDaily: -# create today's daily note with hardcoded template -CreateDaily() { - daysuffix=$(DaySuffix) - daystr=$(LC_TIME=en_US.UTF-8 date +"%A, %B %d$daysuffix, %Y") - datestr="title: $daystr" - echo --- >> $dailyfile - echo $datestr >> $dailyfile - echo --- >> $dailyfile -} - -if [ "$(basename $the_dir)" == "daily" ] ; then - if [ ! -f $dailyfile ] ; then - $(CreateDaily) - fi -fi - -find $the_dir -type f| sort -rn +# sort reversed numerical +find $the_dir -type f | sort -rn