cont.dotodays

This commit is contained in:
Y 2022-09-09 16:25:07 +00:00
parent f572f66cda
commit 93e138a41f
1 changed files with 36 additions and 11 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
# clikan.sh -- CLI Kanban
ver='2022-07-18/HB9KNS'
ver='2022-09-08/HB9KNS'
conf="${CLIKANCONF:-$HOME/.clikanconf}"
defkanban="$HOME/clikanban.md"
@ -83,6 +83,16 @@ getlines(){
}
}
# extract date part of tepatt from argument
getsdate() {
local dp
dp=`echo "$*" | sed -e "s/.*$tepatt.*/\1/"`
if test "$dp" = "$*"
then echo ''
else echo $dp
fi
}
# display selection, and put selection list in selection file,
# input through stdin, with lines prepended with index number, TAB and arg1
showselect(){
@ -193,7 +203,28 @@ repline(){
# put waiting cards of today or older into doing state
dotodays(){
echo :: yet unimplemented
local edate
: > $buff
# scan all kanbans for waiting entries (-) with matching dates
cat $kbs | getlines - | { while read cl
do
edate=`getsdate "$cl"`
echo ::::: $cl ::::: $edate
# if date field exists and is lessequal than today
if test -n "$edate" -a "$edate" -le "$stoday"
# save kanban entry for later
then echo "$cl" >> $buff
fi
done
# if at least one entry was saved
if test -s $buff
then cat $buff | { while read cl
# change flag in all kanbans from waiting (-) to doing (*)
do repline "- $cl" "* $cl"
done
}
fi
}
}
showhelp(){ cat <<EOH
@ -228,7 +259,7 @@ command keys:
f F: filter for grep pattern F (case insensitive, empty='.', use _ for space)
p: show planning (time scheduling) for active (doing) cards containing
@YYMMDD/U.U target date (YYMMDD) and expected duration (U.U)
t: search waiting cards with target date of today or older and put them into doing state
t: put waiting cards with target date of today or older into doing state
h N U.U [[YY]MMDD]: update expected duration for card N and
optionally set new target date [YY]MMDD
(asks for date if card is missing @YYMMDD)
@ -265,11 +296,6 @@ datnum() {
echo $dn
}
# extract tepatt from argument
getsdate() {
echo "$*" | sed -e "s/.*$tepatt.*/\1/"
}
showall doing
showprompt
@ -363,7 +389,7 @@ p) echo "## planning for $planpart% of $tunits $planunit"
*) w8=3 ;;
esac
# get target date number of task, and normalize
tdate=`echo "$task" | sed -e "s/.*$tepatt.*/\1/"`
tdate=`getsdate "$task"`
tnum=`datnum $tdate`
# difference in days
td=$(( $tnum-$now ))
@ -377,7 +403,6 @@ p) echo "## planning for $planpart% of $tunits $planunit"
# get estimated units for task, append '.0' to force decimal notation,
# remove dot, keep one decimal and truncate additional figures
# (i.e multiply by 10), remove leading 0s
# TODO: following 2 lines are really ugly, should be simplified...
tunits=`echo "$task" | sed -e "s/.*$tepatt.*/\2/;s/$/.0/;s/[.]\([0-9]\).*/\1/;s/^0*//"`
# if empty, set to 0
tunits=${tunits:-0}
@ -433,7 +458,7 @@ h) if test "$coa1" = ""
if test "$coa3" = ""
then
# search for ' @YYYYMMDD/U.U' and get YYYYMMDD
odat=`echo "$oldl" | sed -e "s/.*$tepatt.*/\1/"`
odat=`getsdate "$oldl"`
# if nothing found, ask for target date
if test "$odat" = "$oldl"
then