remove uid functionality: cards themselves are unique enough!

enhance config reporting, and some cosmetics
This commit is contained in:
YargoA2 2017-06-21 01:25:27 +02:00
parent c19679e50d
commit 0bdc55a05c
1 changed files with 25 additions and 35 deletions

View File

@ -3,25 +3,24 @@
# 2017-06-20 Y.Bonetti
conf="${CLIKANCONF:-$HOME/.clikanconf}"
defkanban="$HOME/mykanban.txt"
defkanban="$HOME/clikanban.txt"
editor="${CLIKANEDIT:-$VISUAL}"
editor="${editor:-$EDITOR}"
editor="${editor:-/bin/ed}"
echo editor=$editor
editor="${editor:-ed}"
tmpf=$HOME/.clikan.tmp
if test ! -f "$conf"
then echo generating default config file $conf
cat <<EOT >"$conf"
# automatically generated by $0 at `date`
prompt ck>
prompt |<
kanban $defkanban
EOT
echo initializing default kanban file $defkanban
cat <<EOT >"$defkanban"
# my kanban file
* 12345 learn to use clikan
- 23456 improve clikan
* learn to use clikan
- improve clikan
EOT
fi
@ -36,20 +35,15 @@ getlines(){
}
}
# display selection, and put selection list in tempfile
# input through stdin, with lines "key explanation", where "key" is stored
# in tmpf together with index number, and "explanation" is displayed
# (or "key", if "explanation" is empty)
# display selection, and put selection list in tempfile,
# input through stdin, with lines prepended with index number, TAB and arg1
showselect(){
local i
: >$tmpf
i=1
while read j e
do if test "$e" = ""
then e=$j
fi
echo $i: $e
echo "$i $j" >>$tmpf
: >$tmpf
while read l
do echo $i: $l
echo "$i $1$l" >>$tmpf
i=$(( $i+1 ))
done
}
@ -91,12 +85,7 @@ showall(){
esac
echo
echo " $1"
cat "$kbs" | getlines "$f" | showselect
}
# get first complete card with pattern
getfirst(){
cat "$kbs" | grep "$1" | head -n 1
cat "$kbs" | getlines "$f" | showselect "$f "
}
# replace lines (in any kanban) containing some ed pattern
@ -129,8 +118,12 @@ to show configuration, enter 'c'
EOH
read k
case $k in
c*) echo "configfile=$conf // CLIKANCONF=$CLIKANCONF"
echo "configfile contents:"
c*) cat <<EOT
CLIKANCONF=$CLIKANCONF
configfile=$conf
editor=$editor
configfile contents:
EOT
sed -e 's/^/ /' $conf
;;
*) cat <<EOH
@ -149,7 +142,6 @@ EOH
esac
}
echo this is $0
showall doing
showprompt
@ -157,7 +149,7 @@ while read com coa1 coa2 coa3 coar
do case $com in
q*) break ;;
d) showall doing ;;
w) showall waiting/todo ;;
w) showall waiting/todo/backlog ;;
a) showall archived/done ;;
do|wait|done) if test "$coa1" = ""
then echo "card number?"
@ -170,11 +162,11 @@ do|wait|done) if test "$coa1" = ""
wait) coa2='-' ;;
*) coa2='*' ;;
esac
coa3=`getfirst "^.[ ] *$coa1" <$tmpf | sed -e "s/^./$coa2/"`
coa3=`echo "$coa1" | sed -e "s/^./$coa2/"`
#echo coa1=$coa1
#echo coa2=$coa2
#echo coa3=$coa3
repline "^.[ ] *$coa1" "$coa3"
repline "$coa1" "$coa3"
fi
showall doing
;;
@ -185,18 +177,15 @@ k) echo "$kbs" | showselect
n) echo enter new card for target $currkan :
read newc
if test "$newc" != ""
then uid=`date +%s`
echo '-' $uid "$newc" >>$currkan
then echo '-' "$newc" >>$currkan
fi
showall doing
;;
ec) echo calling "$editor $conf" ...
"$editor" "$conf"
echo please quit and restart to reload config ;;
ek) echo "$kbs" | showselect
f=`getselect`
echo calling "$editor $f" ...
"$editor" "$f"
ek) echo calling "$editor $currkan" ...
"$editor" "$currkan"
echo welcome back ;;
*) showhelp
showall doing ;;
@ -204,4 +193,5 @@ esac
showprompt
done
echo
#/bin/rm -f $tmpf