Accept filters for lsprj

This commit is contained in:
jmoore
2011-11-03 10:24:29 +01:00
parent 72fe73f3d8
commit 84880ba525
2 changed files with 29 additions and 2 deletions

23
tests/t1260-listprj.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
test_description='list project functionality
'
. ./test-lib.sh
cat > todo.txt <<EOF
(B) smell the uppercase Roses +roses @outside
(C) notice the sunflowers +sunflowers @garden
stop
EOF
test_todo_session 'basic listproj' <<EOF
>>> todo.sh listproj
+roses
+sunflowers
EOF
test_todo_session 'listproj with context' <<EOF
>>> todo.sh listproj @garden
+sunflowers
EOF
test_done

View File

@@ -59,7 +59,7 @@ shorthelp()
listcon|lsc
listfile|lf SRC [TERM...]
listpri|lsp [PRIORITY] [TERM...]
listproj|lsprj
listproj|lsprj [TERM...]
move|mv ITEM# DEST [SRC]
prepend|prep ITEM# "TEXT TO PREPEND"
pri|p ITEM# PRIORITY
@@ -1007,7 +1007,11 @@ case $action in
;;
"listproj" | "lsprj" )
grep -o '[^ ]*+[^ ]\+' "$TODO_FILE" | grep '^+' | sort -u
shift
export TODOTXT_PLAIN=1
_list "$TODO_FILE" "$@" | grep -o '[^ ]*+[^ ]\+' | grep '^+' | \
sed "s:\[[0-9;]*[mK]::g" | sort -u
;;
"listpri" | "lsp" )