Compare commits

..

2 Commits

Author SHA1 Message Date
Ingo Karkat
272cd5e469 Optimization: Put grep -v empty task filter inside sed.
No need to spawn off another process for this; we can do this inside the sed command that joins the task numbers with the task text.
2011-12-23 22:52:07 +01:00
Ingo Karkat
17658c852d Reformatting: Lay out _list() file numbering in multi-line.
...like the following complex formatting and filtering steps.
2011-12-23 22:51:13 +01:00

17
todo.sh
View File

@@ -199,10 +199,7 @@ help()
list [TERM...]
ls [TERM...]
Displays all tasks that contain TERM(s) sorted by priority with line
numbers. Each task must match all TERMs (logical AND); to display
tasks that contain any TERM (logical OR), use
"TERM1\|TERM2\|..." (with quotes), or TERM1\\\|TERM2 (unquoted).
If no TERM specified, lists entire todo.txt.
numbers. If no TERM specified, lists entire todo.txt.
listall [TERM...]
lsa [TERM...]
@@ -218,7 +215,7 @@ help()
lf [SRC [TERM...]]
Displays all the lines in SRC file located in the todo.txt directory,
sorted by priority with line numbers. If TERM specified, lists
all lines that contain TERM(s) in SRC file.
all lines that contain TERM in SRC file.
Without any arguments, the names of all text files in the todo.txt
directory are listed.
@@ -226,7 +223,7 @@ help()
lsp [PRIORITY] [TERM...]
Displays all tasks prioritized PRIORITY.
If no PRIORITY specified, lists all prioritized tasks.
If TERM specified, lists only prioritized tasks that contain TERM(s).
If TERM specified, lists only prioritized tasks that contain TERM.
listproj
lsprj
@@ -778,8 +775,12 @@ _list() {
fi
items=$(
sed = "$src" \
| sed "N; s/^/ /; s/ *\(.\{$PADDING,\}\)\n/\1 /" \
| grep -v "^[ 0-9]\+ *$"
| sed '''
N
s/^/ /
s/ *\([ 0-9]\{'"$PADDING"',\}\)\n/\1 /
/^[ 0-9]\+ *$/d
'''
)
if [ "${filter_command}" ]; then
filtered_items=$(echo -n "$items" | eval "${filter_command}")