add optional timestamp when adding card; filter out more garbage input
This commit is contained in:
parent
b37bcf455f
commit
fdf854885a
21
clikan.sh
21
clikan.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# clikan.sh -- CLI Kanban
|
# clikan.sh -- CLI Kanban
|
||||||
ver='2021-02-25/HB9KNS'
|
ver='2021-05-07/HB9KNS'
|
||||||
|
|
||||||
conf="${CLIKANCONF:-$HOME/.clikanconf}"
|
conf="${CLIKANCONF:-$HOME/.clikanconf}"
|
||||||
defkanban="$HOME/clikanban.md"
|
defkanban="$HOME/clikanban.md"
|
||||||
|
@ -33,6 +33,9 @@ maxshow 23
|
||||||
# sortdir defines order of non-calendar kanban cards
|
# sortdir defines order of non-calendar kanban cards
|
||||||
# and can be one of up, down or none (default)
|
# and can be one of up, down or none (default)
|
||||||
sortdir up
|
sortdir up
|
||||||
|
# if newdate is 1, yes or true (actually, begins with'[1tTyY]'),
|
||||||
|
# then the current date will be appended to new cards/entries
|
||||||
|
newdate true
|
||||||
# kanban defines a kanban file, may be given several times
|
# kanban defines a kanban file, may be given several times
|
||||||
# kanban /some/path/to/jobkanban.txt
|
# kanban /some/path/to/jobkanban.txt
|
||||||
# kanban /another/path/to/privatekanban.md
|
# kanban /another/path/to/privatekanban.md
|
||||||
|
@ -99,6 +102,11 @@ maxshow=`getlines maxshow <"$conf" | head -n 1`
|
||||||
maxshow=${maxshow:-22}
|
maxshow=${maxshow:-22}
|
||||||
sortdir=`getlines sortdir <"$conf" | head -n 1`
|
sortdir=`getlines sortdir <"$conf" | head -n 1`
|
||||||
sortdir=${sortdir:-none}
|
sortdir=${sortdir:-none}
|
||||||
|
nd=`getlines newdate <"$conf" | head -n 1`
|
||||||
|
case $nd in
|
||||||
|
1|[yY]*|[tT]*) newdate=true ;;
|
||||||
|
*) newdate=false ;;
|
||||||
|
esac
|
||||||
|
|
||||||
showprompt(){
|
showprompt(){
|
||||||
if test "$prompt" != ""
|
if test "$prompt" != ""
|
||||||
|
@ -216,7 +224,10 @@ do|wait|done) if test "$coa1" = ""
|
||||||
then echo "card number?"
|
then echo "card number?"
|
||||||
read coa1
|
read coa1
|
||||||
fi
|
fi
|
||||||
coar=`echo "$coa1 $coa2 $coa3 $coar" | sed -e 's/ *$/ /'`
|
coar=`echo "$coa1 $coa2 $coa3 $coar" | tr -cd ' 0-9' | sed -e 's/ *$/ /'`
|
||||||
|
if test "$coar" = " "
|
||||||
|
then coar=''
|
||||||
|
fi
|
||||||
while test "$coar" != ""
|
while test "$coar" != ""
|
||||||
do
|
do
|
||||||
coa1=`getlines ${coar%% *} <$self`
|
coa1=`getlines ${coar%% *} <$self`
|
||||||
|
@ -245,8 +256,12 @@ n) newc=`echo "$coa1 $coa2 $coa3 $coar" | sed -e 's/ *$//'`
|
||||||
read newc
|
read newc
|
||||||
else echo adding card for target $currkan
|
else echo adding card for target $currkan
|
||||||
fi
|
fi
|
||||||
|
if test $newdate = true
|
||||||
|
then stamp=`date '+ // %y-%m-%d'`
|
||||||
|
else stamp=''
|
||||||
|
fi
|
||||||
if test "$newc" != ""
|
if test "$newc" != ""
|
||||||
then echo '*' "$newc" >>$currkan
|
then echo '*' "$newc$stamp" >>$currkan
|
||||||
else echo no content found, nothing added
|
else echo no content found, nothing added
|
||||||
fi
|
fi
|
||||||
showall doing
|
showall doing
|
||||||
|
|
Loading…
Reference in New Issue