|
|
|
|
@@ -58,7 +58,7 @@ shorthelp()
|
|
|
|
|
list|ls [TERM...]
|
|
|
|
|
listall|lsa [TERM...]
|
|
|
|
|
listaddons
|
|
|
|
|
listcon|lsc
|
|
|
|
|
listcon|lsc [TERM...]
|
|
|
|
|
listfile|lf [SRC [TERM...]]
|
|
|
|
|
listpri|lsp [PRIORITIES] [TERM...]
|
|
|
|
|
listproj|lsprj [TERM...]
|
|
|
|
|
@@ -223,9 +223,10 @@ help()
|
|
|
|
|
listaddons
|
|
|
|
|
Lists all added and overridden actions in the actions directory.
|
|
|
|
|
|
|
|
|
|
listcon
|
|
|
|
|
lsc
|
|
|
|
|
listcon [TERM...]
|
|
|
|
|
lsc [TERM...]
|
|
|
|
|
Lists all the task contexts that start with the @ sign in todo.txt.
|
|
|
|
|
If TERM specified, considers only tasks that contain TERM(s).
|
|
|
|
|
|
|
|
|
|
listfile [SRC [TERM...]]
|
|
|
|
|
lf [SRC [TERM...]]
|
|
|
|
|
@@ -245,10 +246,11 @@ help()
|
|
|
|
|
Hides all tasks that contain TERM(s) preceded by a minus sign
|
|
|
|
|
(i.e. -TERM).
|
|
|
|
|
|
|
|
|
|
listproj
|
|
|
|
|
lsprj
|
|
|
|
|
listproj [TERM...]
|
|
|
|
|
lsprj [TERM...]
|
|
|
|
|
Lists all the projects (terms that start with a + sign) in
|
|
|
|
|
todo.txt.
|
|
|
|
|
If TERM specified, considers only tasks that contain TERM(s).
|
|
|
|
|
|
|
|
|
|
move ITEM# DEST [SRC]
|
|
|
|
|
mv ITEM# DEST [SRC]
|
|
|
|
|
@@ -389,22 +391,21 @@ replaceOrPrepend()
|
|
|
|
|
else
|
|
|
|
|
input=$*
|
|
|
|
|
fi
|
|
|
|
|
cleaninput "for sed"
|
|
|
|
|
|
|
|
|
|
# Retrieve existing priority and prepended date
|
|
|
|
|
local -r priAndDateExpr='^\((.) \)\{0,1\}\([0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} \)\{0,1\}'
|
|
|
|
|
priority=$(sed -e "$item!d" -e "${item}s/${priAndDateExpr}.*/\\1/" "$TODO_FILE")
|
|
|
|
|
prepdate=$(sed -e "$item!d" -e "${item}s/${priAndDateExpr}.*/\\2/" "$TODO_FILE")
|
|
|
|
|
priority=$(sed -e "$item!d" -e $item's/^\((.) \)\{0,1\}\([0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} \)\{0,1\}.*/\1/' "$TODO_FILE")
|
|
|
|
|
prepdate=$(sed -e "$item!d" -e $item's/^\((.) \)\{0,1\}\([0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} \)\{0,1\}.*/\2/' "$TODO_FILE")
|
|
|
|
|
|
|
|
|
|
if [ "$prepdate" -a "$action" = "replace" ] && [ "$(echo "$input"|sed -e "s/${priAndDateExpr}.*/\\1\\2/")" ]; then
|
|
|
|
|
# If the replaced text starts with a [priority +] date, it will replace
|
|
|
|
|
# the existing date, too.
|
|
|
|
|
if [ "$prepdate" -a "$action" = "replace" ] && [ "$(echo "$input"|sed -e 's/^\([0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\}\)\{0,1\}.*/\1/')" ]; then
|
|
|
|
|
# If the replaced text starts with a date, it will replace the existing
|
|
|
|
|
# date, too.
|
|
|
|
|
prepdate=
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Temporarily remove any existing priority and prepended date, perform the
|
|
|
|
|
# change (replace/prepend) and re-insert the existing priority and prepended
|
|
|
|
|
# date again.
|
|
|
|
|
cleaninput "for sed"
|
|
|
|
|
sed -i.bak -e "$item s/^${priority}${prepdate}//" -e "$item s|^.*|${priority}${prepdate}${input}${backref}|" "$TODO_FILE"
|
|
|
|
|
if [ $TODOTXT_VERBOSE -gt 0 ]; then
|
|
|
|
|
getNewtodo "$item"
|
|
|
|
|
@@ -859,7 +860,17 @@ _format()
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export -f cleaninput getPrefix getTodo getNewtodo shellquote filtercommand _list getPadding _format die
|
|
|
|
|
listWordsWithSigil()
|
|
|
|
|
{
|
|
|
|
|
sigil=$1
|
|
|
|
|
shift
|
|
|
|
|
|
|
|
|
|
FILE=$TODO_FILE
|
|
|
|
|
[ "$TODOTXT_SOURCEVAR" ] && eval "FILE=$TODOTXT_SOURCEVAR"
|
|
|
|
|
eval "$(filtercommand 'cat "${FILE[@]}"' '' "$@")" | grep -o "[^ ]*${sigil}[^ ]\\+" | grep "^$sigil" | sort -u
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export -f cleaninput getPrefix getTodo getNewtodo shellquote filtercommand _list listWordsWithSigil getPadding _format die
|
|
|
|
|
|
|
|
|
|
# == HANDLE ACTION ==
|
|
|
|
|
action=$( printf "%s\n" "$ACTION" | tr 'A-Z' 'a-z' )
|
|
|
|
|
@@ -1134,16 +1145,13 @@ case $action in
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
"listcon" | "lsc" )
|
|
|
|
|
FILE=$TODO_FILE
|
|
|
|
|
[ "$TODOTXT_SOURCEVAR" ] && eval "FILE=$TODOTXT_SOURCEVAR"
|
|
|
|
|
grep -ho '[^ ]*@[^ ]\+' "${FILE[@]}" | grep '^@' | sort -u
|
|
|
|
|
shift
|
|
|
|
|
listWordsWithSigil '@' "$@"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
"listproj" | "lsprj" )
|
|
|
|
|
FILE=$TODO_FILE
|
|
|
|
|
[ "$TODOTXT_SOURCEVAR" ] && eval "FILE=$TODOTXT_SOURCEVAR"
|
|
|
|
|
shift
|
|
|
|
|
eval "$(filtercommand 'cat "${FILE[@]}"' '' "$@")" | grep -o '[^ ]*+[^ ]\+' | grep '^+' | sort -u
|
|
|
|
|
listWordsWithSigil '+' "$@"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
"listpri" | "lsp" )
|
|
|
|
|
|