Initial version of done functionality w/ basic test.

This commit is contained in:
Jared Cordasco
2010-04-13 10:38:01 -05:00
parent 5a5f3bd24d
commit d3c14201a5
2 changed files with 72 additions and 0 deletions

20
todo.sh
View File

@@ -799,6 +799,26 @@ case $action in
fi
cleanup ;;
"done" )
if [[ -z "$2" && $TODOTXT_FORCE = 0 ]]; then
echo -n "Done: "
read input
else
[ -z "$2" ] && die "usage: $TODO_SH done \"TODO ITEM\""
shift
input=$*
fi
now=`date '+%Y-%m-%d'`
# remove priority once item is done
newtodo=$(sed -e "s/^(.) // ; s|^|&x $now |" <<<${input})
echo "$newtodo" >> "$DONE_FILE"
[ $TODOTXT_VERBOSE -gt 0 ] && {
echo "TODO: '$input' marked as done."
}
cleanup;;
"help" )
if [ -t 1 ] ; then # STDOUT is a TTY
if (exec which ${PAGER:-less} 2>/dev/null >/dev/null); then