From b8244792cc429c320e8a2abf1892342b2aefb4cc Mon Sep 17 00:00:00 2001 From: jmoore Date: Thu, 3 Nov 2011 10:24:29 +0100 Subject: [PATCH] Accept filters for lsprj --- tests/t1260-listprj.sh | 23 +++++++++++++++++++++++ todo.sh | 8 ++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100755 tests/t1260-listprj.sh diff --git a/tests/t1260-listprj.sh b/tests/t1260-listprj.sh new file mode 100755 index 0000000..b3e0635 --- /dev/null +++ b/tests/t1260-listprj.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +test_description='list project functionality +' +. ./test-lib.sh + +cat > todo.txt <>> todo.sh listproj ++roses ++sunflowers +EOF + +test_todo_session 'listproj with context' <>> todo.sh listproj @garden ++sunflowers +EOF + +test_done diff --git a/todo.sh b/todo.sh index 4545c00..e50c0b9 100755 --- a/todo.sh +++ b/todo.sh @@ -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 @@ -1048,7 +1048,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" )