Compare commits
12 Commits
archive/ne
...
archive/li
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3fc18af6b | ||
|
|
c99543506a | ||
|
|
b4aaba8387 | ||
|
|
493e975199 | ||
|
|
fda31ea260 | ||
|
|
8744167827 | ||
|
|
73e28b7225 | ||
|
|
43bd1b645b | ||
|
|
4db4494f03 | ||
|
|
799840b664 | ||
|
|
54f15a7854 | ||
|
|
17658c852d |
@@ -21,6 +21,7 @@ h2. Quick Links
|
|||||||
* Original anemic release by "Gina Trapani":http://ginatrapani.org on 5/11/2006.
|
* Original anemic release by "Gina Trapani":http://ginatrapani.org on 5/11/2006.
|
||||||
* Raised to great heights by "brainy and dedicated volunteers":http://github.com/ginatrapani/todo.txt-cli/network.
|
* Raised to great heights by "brainy and dedicated volunteers":http://github.com/ginatrapani/todo.txt-cli/network.
|
||||||
* Licensed under the "GPL":http://www.gnu.org/copyleft/gpl.html
|
* Licensed under the "GPL":http://www.gnu.org/copyleft/gpl.html
|
||||||
* "Add-on Directory":http://wiki.github.com/ginatrapani/todo.txt-cli/todosh-add-on-directory
|
* "Add-on Directory":https://github.com/ginatrapani/todo.txt-cli/wiki/Todo.sh-Add-on-Directory
|
||||||
|
https://github.com/ginatrapani/todo.txt-cli/wiki/Creating-and-Installing-Add-ons
|
||||||
* "Changelog":http://wiki.github.com/ginatrapani/todo.txt-cli/todosh-changelog
|
* "Changelog":http://wiki.github.com/ginatrapani/todo.txt-cli/todosh-changelog
|
||||||
* "Known Bugs":http://github.com/ginatrapani/todo.txt-cli/issues
|
* "Known Bugs":http://github.com/ginatrapani/todo.txt-cli/issues
|
||||||
@@ -45,6 +45,8 @@ test_expect_success 'null listpri a' '
|
|||||||
cat > expect <<EOF
|
cat > expect <<EOF
|
||||||
--
|
--
|
||||||
TODO: 0 of 0 tasks shown
|
TODO: 0 of 0 tasks shown
|
||||||
|
DONE: 0 of 0 tasks shown
|
||||||
|
total 0 of 0 tasks shown
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'null lsa' '
|
test_expect_success 'null lsa' '
|
||||||
|
|||||||
@@ -53,6 +53,18 @@ test_todo_session 'checking TODOTXT_FINAL_FILTER' <<EOF
|
|||||||
TODO: 3 of 3 tasks shown
|
TODO: 3 of 3 tasks shown
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
#
|
||||||
|
# check the custom hiding
|
||||||
|
#
|
||||||
|
test_todo_session 'checking HIDE_CUSTOM_SUBSTITUTION' <<EOF
|
||||||
|
>>> HIDE_CUSTOM_SUBSTITUTION='[tT]h' todo.sh ls
|
||||||
|
2 aaa zzz is line should be first.
|
||||||
|
3 bbb yyy is line should be second.
|
||||||
|
1 ccc xxx is line should be ird.
|
||||||
|
--
|
||||||
|
TODO: 3 of 3 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
#
|
#
|
||||||
# check the filtering of TERM
|
# check the filtering of TERM
|
||||||
#
|
#
|
||||||
|
|||||||
150
tests/t1350-listall.sh
Executable file
150
tests/t1350-listall.sh
Executable file
@@ -0,0 +1,150 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
test_description='listall functionality
|
||||||
|
'
|
||||||
|
. ./test-lib.sh
|
||||||
|
|
||||||
|
cat > todo.txt <<EOF
|
||||||
|
smell the uppercase Roses +flowers @outside
|
||||||
|
x 2011-08-08 tend the garden @outside
|
||||||
|
notice the sunflowers
|
||||||
|
x 2011-12-26 go outside +wakeup
|
||||||
|
(A) stop
|
||||||
|
EOF
|
||||||
|
cat > done.txt <<EOF
|
||||||
|
x 2011-12-01 eat breakfast
|
||||||
|
x 2011-12-05 smell the coffee +wakeup
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_todo_session 'basic listall' <<EOF
|
||||||
|
>>> todo.sh -p listall
|
||||||
|
5 (A) stop
|
||||||
|
3 notice the sunflowers
|
||||||
|
1 smell the uppercase Roses +flowers @outside
|
||||||
|
2 x 2011-08-08 tend the garden @outside
|
||||||
|
0 x 2011-12-01 eat breakfast
|
||||||
|
0 x 2011-12-05 smell the coffee +wakeup
|
||||||
|
4 x 2011-12-26 go outside +wakeup
|
||||||
|
--
|
||||||
|
TODO: 5 of 5 tasks shown
|
||||||
|
DONE: 2 of 2 tasks shown
|
||||||
|
total 7 of 7 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_todo_session 'listall highlighting' <<EOF
|
||||||
|
>>> todo.sh listall
|
||||||
|
[1;33m5 (A) stop[0m
|
||||||
|
3 notice the sunflowers
|
||||||
|
1 smell the uppercase Roses +flowers @outside
|
||||||
|
[0;37m2 x 2011-08-08 tend the garden @outside[0m
|
||||||
|
[0;37m0 x 2011-12-01 eat breakfast[0m
|
||||||
|
[0;37m0 x 2011-12-05 smell the coffee +wakeup[0m
|
||||||
|
[0;37m4 x 2011-12-26 go outside +wakeup[0m
|
||||||
|
--
|
||||||
|
TODO: 5 of 5 tasks shown
|
||||||
|
DONE: 2 of 2 tasks shown
|
||||||
|
total 7 of 7 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_todo_session 'listall nonverbose' <<EOF
|
||||||
|
>>> TODOTXT_VERBOSE=0 todo.sh -p listall
|
||||||
|
5 (A) stop
|
||||||
|
3 notice the sunflowers
|
||||||
|
1 smell the uppercase Roses +flowers @outside
|
||||||
|
2 x 2011-08-08 tend the garden @outside
|
||||||
|
0 x 2011-12-01 eat breakfast
|
||||||
|
0 x 2011-12-05 smell the coffee +wakeup
|
||||||
|
4 x 2011-12-26 go outside +wakeup
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_todo_session 'listall filtering' <<EOF
|
||||||
|
>>> todo.sh -p listall @outside
|
||||||
|
1 smell the uppercase Roses +flowers @outside
|
||||||
|
2 x 2011-08-08 tend the garden @outside
|
||||||
|
--
|
||||||
|
TODO: 2 of 5 tasks shown
|
||||||
|
DONE: 0 of 2 tasks shown
|
||||||
|
total 2 of 7 tasks shown
|
||||||
|
|
||||||
|
>>> todo.sh -p listall the
|
||||||
|
3 notice the sunflowers
|
||||||
|
1 smell the uppercase Roses +flowers @outside
|
||||||
|
2 x 2011-08-08 tend the garden @outside
|
||||||
|
0 x 2011-12-05 smell the coffee +wakeup
|
||||||
|
--
|
||||||
|
TODO: 3 of 5 tasks shown
|
||||||
|
DONE: 1 of 2 tasks shown
|
||||||
|
total 4 of 7 tasks shown
|
||||||
|
|
||||||
|
>>> todo.sh -p listall breakfast
|
||||||
|
0 x 2011-12-01 eat breakfast
|
||||||
|
--
|
||||||
|
TODO: 0 of 5 tasks shown
|
||||||
|
DONE: 1 of 2 tasks shown
|
||||||
|
total 1 of 7 tasks shown
|
||||||
|
|
||||||
|
>>> todo.sh -p listall doesnotmatch
|
||||||
|
--
|
||||||
|
TODO: 0 of 5 tasks shown
|
||||||
|
DONE: 0 of 2 tasks shown
|
||||||
|
total 0 of 7 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat >> done.txt <<EOF
|
||||||
|
x 2010-01-01 old task 1
|
||||||
|
x 2010-01-01 old task 2
|
||||||
|
x 2010-01-01 old task 3
|
||||||
|
x 2010-01-01 old task 4
|
||||||
|
EOF
|
||||||
|
test_todo_session 'listall number width' <<EOF
|
||||||
|
>>> todo.sh -p listall
|
||||||
|
5 (A) stop
|
||||||
|
3 notice the sunflowers
|
||||||
|
1 smell the uppercase Roses +flowers @outside
|
||||||
|
0 x 2010-01-01 old task 1
|
||||||
|
0 x 2010-01-01 old task 2
|
||||||
|
0 x 2010-01-01 old task 3
|
||||||
|
0 x 2010-01-01 old task 4
|
||||||
|
2 x 2011-08-08 tend the garden @outside
|
||||||
|
0 x 2011-12-01 eat breakfast
|
||||||
|
0 x 2011-12-05 smell the coffee +wakeup
|
||||||
|
4 x 2011-12-26 go outside +wakeup
|
||||||
|
--
|
||||||
|
TODO: 5 of 5 tasks shown
|
||||||
|
DONE: 6 of 6 tasks shown
|
||||||
|
total 11 of 11 tasks shown
|
||||||
|
|
||||||
|
>>> TODOTXT_VERBOSE=0 todo.sh add new task 1
|
||||||
|
|
||||||
|
>>> TODOTXT_VERBOSE=0 todo.sh add new task 2
|
||||||
|
|
||||||
|
>>> TODOTXT_VERBOSE=0 todo.sh add new task 3
|
||||||
|
|
||||||
|
>>> TODOTXT_VERBOSE=0 todo.sh add new task 4
|
||||||
|
|
||||||
|
>>> TODOTXT_VERBOSE=0 todo.sh add new task 5
|
||||||
|
|
||||||
|
>>> todo.sh -p listall
|
||||||
|
05 (A) stop
|
||||||
|
06 new task 1
|
||||||
|
07 new task 2
|
||||||
|
08 new task 3
|
||||||
|
09 new task 4
|
||||||
|
10 new task 5
|
||||||
|
03 notice the sunflowers
|
||||||
|
01 smell the uppercase Roses +flowers @outside
|
||||||
|
00 x 2010-01-01 old task 1
|
||||||
|
00 x 2010-01-01 old task 2
|
||||||
|
00 x 2010-01-01 old task 3
|
||||||
|
00 x 2010-01-01 old task 4
|
||||||
|
02 x 2011-08-08 tend the garden @outside
|
||||||
|
00 x 2011-12-01 eat breakfast
|
||||||
|
00 x 2011-12-05 smell the coffee +wakeup
|
||||||
|
04 x 2011-12-26 go outside +wakeup
|
||||||
|
--
|
||||||
|
TODO: 10 of 10 tasks shown
|
||||||
|
DONE: 6 of 6 tasks shown
|
||||||
|
total 16 of 16 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_done
|
||||||
66
todo.sh
66
todo.sh
@@ -67,6 +67,8 @@ shorthelp()
|
|||||||
report
|
report
|
||||||
shorthelp
|
shorthelp
|
||||||
|
|
||||||
|
Actions can be added and overridden using scripts in the actions
|
||||||
|
directory.
|
||||||
EndHelp
|
EndHelp
|
||||||
|
|
||||||
# Only list the one-line usage from the add-on actions. This assumes that
|
# Only list the one-line usage from the add-on actions. This assumes that
|
||||||
@@ -87,10 +89,10 @@ help()
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
-@
|
-@
|
||||||
Hide context names in list output. Use twice to show context
|
Hide context names in list output. Use twice to show context
|
||||||
names (default).
|
names (default).
|
||||||
-+
|
-+
|
||||||
Hide project names in list output. Use twice to show project
|
Hide project names in list output. Use twice to show project
|
||||||
names (default).
|
names (default).
|
||||||
-c
|
-c
|
||||||
Color mode
|
Color mode
|
||||||
@@ -103,7 +105,7 @@ help()
|
|||||||
-p
|
-p
|
||||||
Plain mode turns off colors
|
Plain mode turns off colors
|
||||||
-P
|
-P
|
||||||
Hide priority labels in list output. Use twice to show
|
Hide priority labels in list output. Use twice to show
|
||||||
priority labels (default).
|
priority labels (default).
|
||||||
-a
|
-a
|
||||||
Don't auto-archive tasks automatically on completion
|
Don't auto-archive tasks automatically on completion
|
||||||
@@ -162,7 +164,6 @@ help()
|
|||||||
Adds FIRST THING I NEED TO DO to your todo.txt on its own line and
|
Adds FIRST THING I NEED TO DO to your todo.txt on its own line and
|
||||||
Adds SECOND THING I NEED TO DO to you todo.txt on its own line.
|
Adds SECOND THING I NEED TO DO to you todo.txt on its own line.
|
||||||
Project and context notation optional.
|
Project and context notation optional.
|
||||||
Quotes optional.
|
|
||||||
|
|
||||||
addto DEST "TEXT TO ADD"
|
addto DEST "TEXT TO ADD"
|
||||||
Adds a line of text to any file located in the todo.txt directory.
|
Adds a line of text to any file located in the todo.txt directory.
|
||||||
@@ -199,13 +200,19 @@ help()
|
|||||||
list [TERM...]
|
list [TERM...]
|
||||||
ls [TERM...]
|
ls [TERM...]
|
||||||
Displays all tasks that contain TERM(s) sorted by priority with line
|
Displays all tasks that contain TERM(s) sorted by priority with line
|
||||||
numbers. If no TERM specified, lists entire todo.txt.
|
numbers. Each task must match all TERM(s) (logical AND); to display
|
||||||
|
tasks that contain any TERM (logical OR), use
|
||||||
|
"TERM1\|TERM2\|..." (with quotes), or TERM1\\\|TERM2 (unquoted).
|
||||||
|
Hides all tasks that contain TERM(s) preceded by a
|
||||||
|
minus sign (i.e. -TERM). If no TERM specified, lists entire todo.txt.
|
||||||
|
|
||||||
listall [TERM...]
|
listall [TERM...]
|
||||||
lsa [TERM...]
|
lsa [TERM...]
|
||||||
Displays all the lines in todo.txt AND done.txt that contain TERM(s)
|
Displays all the lines in todo.txt AND done.txt that contain TERM(s)
|
||||||
sorted by priority with line numbers. If no TERM specified, lists
|
sorted by priority with line numbers. Hides all tasks that
|
||||||
entire todo.txt AND done.txt concatenated and sorted.
|
contain TERM(s) preceded by a minus sign (i.e. -TERM). If no
|
||||||
|
TERM specified, lists entire todo.txt AND done.txt
|
||||||
|
concatenated and sorted.
|
||||||
|
|
||||||
listcon
|
listcon
|
||||||
lsc
|
lsc
|
||||||
@@ -215,7 +222,8 @@ help()
|
|||||||
lf [SRC [TERM...]]
|
lf [SRC [TERM...]]
|
||||||
Displays all the lines in SRC file located in the todo.txt directory,
|
Displays all the lines in SRC file located in the todo.txt directory,
|
||||||
sorted by priority with line numbers. If TERM specified, lists
|
sorted by priority with line numbers. If TERM specified, lists
|
||||||
all lines that contain TERM in SRC file.
|
all lines that contain TERM(s) in SRC file. Hides all tasks that
|
||||||
|
contain TERM(s) preceded by a minus sign (i.e. -TERM).
|
||||||
Without any arguments, the names of all text files in the todo.txt
|
Without any arguments, the names of all text files in the todo.txt
|
||||||
directory are listed.
|
directory are listed.
|
||||||
|
|
||||||
@@ -223,11 +231,14 @@ help()
|
|||||||
lsp [PRIORITY] [TERM...]
|
lsp [PRIORITY] [TERM...]
|
||||||
Displays all tasks prioritized PRIORITY.
|
Displays all tasks prioritized PRIORITY.
|
||||||
If no PRIORITY specified, lists all prioritized tasks.
|
If no PRIORITY specified, lists all prioritized tasks.
|
||||||
If TERM specified, lists only prioritized tasks that contain TERM.
|
If TERM specified, lists only prioritized tasks that contain TERM(s).
|
||||||
|
Hides all tasks that contain TERM(s) preceded by a minus sign
|
||||||
|
(i.e. -TERM).
|
||||||
|
|
||||||
listproj
|
listproj
|
||||||
lsprj
|
lsprj
|
||||||
Lists all the projects that start with the + sign in todo.txt.
|
Lists all the projects (terms that start with a + sign) in
|
||||||
|
todo.txt.
|
||||||
|
|
||||||
move ITEM# DEST [SRC]
|
move ITEM# DEST [SRC]
|
||||||
mv ITEM# DEST [SRC]
|
mv ITEM# DEST [SRC]
|
||||||
@@ -245,7 +256,7 @@ help()
|
|||||||
p ITEM# PRIORITY
|
p ITEM# PRIORITY
|
||||||
Adds PRIORITY to task on line ITEM#. If the task is already
|
Adds PRIORITY to task on line ITEM#. If the task is already
|
||||||
prioritized, replaces current priority with new PRIORITY.
|
prioritized, replaces current priority with new PRIORITY.
|
||||||
PRIORITY must be an uppercase letter between A and Z.
|
PRIORITY must be a letter between A and Z.
|
||||||
|
|
||||||
replace ITEM# "UPDATED TODO"
|
replace ITEM# "UPDATED TODO"
|
||||||
Replaces task on line ITEM# with UPDATED TODO.
|
Replaces task on line ITEM# with UPDATED TODO.
|
||||||
@@ -256,7 +267,6 @@ help()
|
|||||||
shorthelp
|
shorthelp
|
||||||
List the one-line usage of all built-in and add-on actions.
|
List the one-line usage of all built-in and add-on actions.
|
||||||
|
|
||||||
|
|
||||||
EndActionsHelp
|
EndActionsHelp
|
||||||
|
|
||||||
addonHelp
|
addonHelp
|
||||||
@@ -775,8 +785,12 @@ _list() {
|
|||||||
fi
|
fi
|
||||||
items=$(
|
items=$(
|
||||||
sed = "$src" \
|
sed = "$src" \
|
||||||
| sed "N; s/^/ /; s/ *\(.\{$PADDING,\}\)\n/\1 /" \
|
| sed -e '''
|
||||||
| grep -v "^[ 0-9]\+ *$"
|
N
|
||||||
|
s/^/ /
|
||||||
|
s/ *\([ 0-9]\{'"$PADDING"',\}\)\n/\1 /
|
||||||
|
/^[ 0-9]\{1,\} *$/d
|
||||||
|
'''
|
||||||
)
|
)
|
||||||
if [ "${filter_command}" ]; then
|
if [ "${filter_command}" ]; then
|
||||||
filtered_items=$(echo -n "$items" | eval "${filter_command}")
|
filtered_items=$(echo -n "$items" | eval "${filter_command}")
|
||||||
@@ -812,8 +826,9 @@ _list() {
|
|||||||
}
|
}
|
||||||
''' \
|
''' \
|
||||||
| sed '''
|
| sed '''
|
||||||
s/'${HIDE_PROJECTS_SUBSTITUTION:-^}'//g
|
s/'"${HIDE_PROJECTS_SUBSTITUTION:-^}"'//g
|
||||||
s/'${HIDE_CONTEXTS_SUBSTITUTION:-^}'//g
|
s/'"${HIDE_CONTEXTS_SUBSTITUTION:-^}"'//g
|
||||||
|
s/'"${HIDE_CUSTOM_SUBSTITUTION:-^}"'//g
|
||||||
''' \
|
''' \
|
||||||
| eval ${TODOTXT_FINAL_FILTER} \
|
| eval ${TODOTXT_FINAL_FILTER} \
|
||||||
)
|
)
|
||||||
@@ -991,7 +1006,7 @@ case $action in
|
|||||||
|
|
||||||
# Split multiple depri's, if comma separated change to whitespace separated
|
# Split multiple depri's, if comma separated change to whitespace separated
|
||||||
# Loop the 'depri' function for each item
|
# Loop the 'depri' function for each item
|
||||||
for item in $(echo $* | tr ',' ' '); do
|
for item in ${*//,/ }; do
|
||||||
getTodo "$item"
|
getTodo "$item"
|
||||||
|
|
||||||
if [[ "$todo" = \(?\)\ * ]]; then
|
if [[ "$todo" = \(?\)\ * ]]; then
|
||||||
@@ -1015,7 +1030,7 @@ case $action in
|
|||||||
|
|
||||||
# Split multiple do's, if comma separated change to whitespace separated
|
# Split multiple do's, if comma separated change to whitespace separated
|
||||||
# Loop the 'do' function for each item
|
# Loop the 'do' function for each item
|
||||||
for item in $(echo $* | tr ',' ' '); do
|
for item in ${*//,/ }; do
|
||||||
getTodo "$item"
|
getTodo "$item"
|
||||||
|
|
||||||
# Check if this item has already been done
|
# Check if this item has already been done
|
||||||
@@ -1068,7 +1083,20 @@ case $action in
|
|||||||
shift ## Was lsa; new $1 is first search term
|
shift ## Was lsa; new $1 is first search term
|
||||||
|
|
||||||
cat "$TODO_FILE" "$DONE_FILE" > "$TMP_FILE"
|
cat "$TODO_FILE" "$DONE_FILE" > "$TMP_FILE"
|
||||||
_list "$TMP_FILE" "$@"
|
TOTAL=$( sed -n '$ =' "$TODO_FILE" )
|
||||||
|
|
||||||
|
post_filter_command="awk -v TOTAL=$TOTAL -v PADDING=${#TOTAL} '{ \$1 = sprintf(\"%\" PADDING \"d\", (\$1 > TOTAL ? 0 : \$1)); print }' "
|
||||||
|
TODOTXT_VERBOSE=0 _list "$TMP_FILE" "$@"
|
||||||
|
|
||||||
|
if [ $TODOTXT_VERBOSE -gt 0 ]; then
|
||||||
|
TDONE=$( sed -n '$ =' "$DONE_FILE" )
|
||||||
|
TASKNUM=$(TODOTXT_PLAIN=1 TODOTXT_VERBOSE=0 _list "$TODO_FILE" "$@" | sed -n '$ =')
|
||||||
|
DONENUM=$(TODOTXT_PLAIN=1 TODOTXT_VERBOSE=0 _list "$DONE_FILE" "$@" | sed -n '$ =')
|
||||||
|
echo "--"
|
||||||
|
echo "$(getPrefix "$TODO_FILE"): ${TASKNUM:-0} of ${TOTAL:-0} tasks shown"
|
||||||
|
echo "$(getPrefix "$DONE_FILE"): ${DONENUM:-0} of ${TDONE:-0} tasks shown"
|
||||||
|
echo "total $((TASKNUM + DONENUM)) of $((TOTAL + TDONE)) tasks shown"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"listfile" | "lf" )
|
"listfile" | "lf" )
|
||||||
|
|||||||
@@ -38,20 +38,28 @@ _todo()
|
|||||||
+*) completions=$(TODOTXT_VERBOSE=0 todo.sh command listproj);;
|
+*) completions=$(TODOTXT_VERBOSE=0 todo.sh command listproj);;
|
||||||
@*) completions=$(TODOTXT_VERBOSE=0 todo.sh command listcon);;
|
@*) completions=$(TODOTXT_VERBOSE=0 todo.sh command listcon);;
|
||||||
*) if [[ "$cur" =~ ^[0-9]+$ ]]; then
|
*) if [[ "$cur" =~ ^[0-9]+$ ]]; then
|
||||||
local item=$(TODOTXT_VERBOSE=0 todo.sh -@ -+ -p -x command ls "^ *${cur} " | head -n 1)
|
|
||||||
|
|
||||||
# Remove the (padded) task number; we prepend the
|
# Remove the (padded) task number; we prepend the
|
||||||
# user-provided $cur.
|
# user-provided $cur instead.
|
||||||
item=${item#* }
|
# Remove the timestamp prepended by the -t option,
|
||||||
|
# and the done date (for done tasks); there's no
|
||||||
# Remove the timestamp prepended by the -t option;
|
# todo.txt option for that yet.
|
||||||
# there's no todo.txt option for that yet.
|
# But keep priority and "x"; they're short and may
|
||||||
item=${item#[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] }
|
# provide useful context.
|
||||||
|
# Remove any trailing whitespace; the Bash
|
||||||
|
# completion inserts a trailing space itself.
|
||||||
|
# Finally, limit the output to a single line just as
|
||||||
|
# a safety check of the ls action output.
|
||||||
|
local todo=$( \
|
||||||
|
TODOTXT_VERBOSE=0 todo.sh -@ -+ -p -x command ls "^ *${cur} " | \
|
||||||
|
sed -e 's/^ *[0-9]\+ //' -e 's/\((.) \)[0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} /\1/' \
|
||||||
|
-e 's/\([xX] \)\([0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} \)\{1,2\}/\1/' \
|
||||||
|
-e 's/[[:space:]]*$//' \
|
||||||
|
-e '1q' \
|
||||||
|
)
|
||||||
# Append task text as a shell comment. This
|
# Append task text as a shell comment. This
|
||||||
# completion can be a safety check before a
|
# completion can be a safety check before a
|
||||||
# destructive todo.txt operation.
|
# destructive todo.txt operation.
|
||||||
[ "$item" ] && COMPREPLY[0]="$cur # $item"
|
[ "$todo" ] && COMPREPLY[0]="$cur # $todo"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user