Compare commits
1 Commits
archive/li
...
archive/de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddd3e9711b |
2
Makefile
2
Makefile
@@ -13,7 +13,7 @@ VERSION-FILE: .FORCE-VERSION-FILE
|
||||
todo.sh: VERSION-FILE
|
||||
|
||||
# For packaging
|
||||
DISTFILES := todo.cfg todo_completion
|
||||
DISTFILES := todo.cfg
|
||||
|
||||
DISTNAME=todo.txt_cli-$(VERSION)
|
||||
dist: $(DISTFILES) todo.sh
|
||||
|
||||
@@ -21,7 +21,6 @@ h2. Quick Links
|
||||
* 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.
|
||||
* Licensed under the "GPL":http://www.gnu.org/copyleft/gpl.html
|
||||
* "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
|
||||
* "Add-on Directory":http://wiki.github.com/ginatrapani/todo.txt-cli/todosh-add-on-directory
|
||||
* "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,8 +45,6 @@ test_expect_success 'null listpri a' '
|
||||
cat > expect <<EOF
|
||||
--
|
||||
TODO: 0 of 0 tasks shown
|
||||
DONE: 0 of 0 tasks shown
|
||||
total 0 of 0 tasks shown
|
||||
EOF
|
||||
|
||||
test_expect_success 'null lsa' '
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='no old-style backtick command substitution
|
||||
|
||||
This test checks the todo.sh script itself for occurrences
|
||||
of old-style backtick command substitution, which should be
|
||||
replaced with $(...).
|
||||
On failure, it will print each offending line number and line.
|
||||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
test_todo_session 'no old-style backtick command substitution' <<EOF
|
||||
>>> sed -n -e 's/\(^\|[ \t]\)#.*//' -e '/\`/{' -e '=;p' -e '}' "$(which todo.sh)"
|
||||
EOF
|
||||
|
||||
test_done
|
||||
@@ -77,37 +77,4 @@ TODO: 5 added.
|
||||
TODO: 5 of 5 tasks shown
|
||||
EOF
|
||||
|
||||
#
|
||||
# Advanced add
|
||||
#
|
||||
|
||||
cat /dev/null > todo.txt
|
||||
test_todo_session 'add with spaces' <<EOF
|
||||
>>> todo.sh add "notice the three spaces"
|
||||
1 notice the three spaces
|
||||
TODO: 1 added.
|
||||
|
||||
>>> todo.sh add notice how the spaces get lost
|
||||
2 notice how the spaces get lost
|
||||
TODO: 2 added.
|
||||
|
||||
>>> todo.sh list
|
||||
2 notice how the spaces get lost
|
||||
1 notice the three spaces
|
||||
--
|
||||
TODO: 2 of 2 tasks shown
|
||||
EOF
|
||||
|
||||
cat /dev/null > todo.txt
|
||||
test_todo_session 'add with CR' <<EOF
|
||||
>>> todo.sh add "smell the
|
||||
Carriage Return"
|
||||
1 smell the Carriage Return
|
||||
TODO: 1 added.
|
||||
|
||||
>>> todo.sh list
|
||||
1 smell the Carriage Return
|
||||
--
|
||||
TODO: 1 of 1 tasks shown
|
||||
EOF
|
||||
test_done
|
||||
|
||||
@@ -21,22 +21,6 @@ TODO: 1 added.
|
||||
TODO: 1 of 1 tasks shown
|
||||
EOF
|
||||
|
||||
test_todo_session 'cmd line first day with priority' <<EOF
|
||||
>>> todo.sh -pt add '(A) notice the daisies'
|
||||
2 (A) 2009-02-13 notice the daisies
|
||||
TODO: 2 added.
|
||||
|
||||
>>> todo.sh -p list
|
||||
2 (A) 2009-02-13 notice the daisies
|
||||
1 2009-02-13 notice the daisies
|
||||
--
|
||||
TODO: 2 of 2 tasks shown
|
||||
|
||||
>>> todo.sh -npf del 2
|
||||
2 (A) 2009-02-13 notice the daisies
|
||||
TODO: 2 deleted.
|
||||
EOF
|
||||
|
||||
test_tick
|
||||
|
||||
test_todo_session 'cmd line second day' <<EOF
|
||||
|
||||
@@ -39,24 +39,6 @@ GARDEN: 2 added.
|
||||
GARDEN: 2 of 2 tasks shown
|
||||
EOF
|
||||
|
||||
#
|
||||
# List available files
|
||||
#
|
||||
test_todo_session 'list available files' <<EOF
|
||||
>>> todo.sh listfile
|
||||
Files in the todo.txt directory:
|
||||
done.txt
|
||||
garden.txt
|
||||
report.txt
|
||||
todo.txt
|
||||
|
||||
>>> TODOTXT_VERBOSE=0 todo.sh listfile
|
||||
done.txt
|
||||
garden.txt
|
||||
report.txt
|
||||
todo.txt
|
||||
EOF
|
||||
|
||||
#
|
||||
# Filter
|
||||
#
|
||||
|
||||
@@ -45,12 +45,6 @@ grow some corn
|
||||
thrash some hay
|
||||
chase the chickens
|
||||
EOF
|
||||
test_todo_session 'replace error' << EOF
|
||||
>>> todo.sh replace 10 "hej!"
|
||||
=== 1
|
||||
TODO: No task 10.
|
||||
EOF
|
||||
|
||||
test_todo_session 'replace in multi-item file' <<EOF
|
||||
>>> todo.sh replace 1 smell the cheese
|
||||
1 smell the cows
|
||||
@@ -68,59 +62,33 @@ TODO: Replaced task with:
|
||||
4 collect the eggs
|
||||
EOF
|
||||
|
||||
echo '(A) collect the eggs' > todo.txt
|
||||
test_todo_session 'replace with priority' <<EOF
|
||||
>>> todo.sh replace 1 "collect the bread"
|
||||
1 (A) collect the eggs
|
||||
TODO: Replaced task with:
|
||||
1 (A) collect the bread
|
||||
>>> todo.sh pri 4 a
|
||||
4 (A) collect the eggs
|
||||
TODO: 4 prioritized (A).
|
||||
|
||||
>>> todo.sh replace 1 collect the eggs
|
||||
1 (A) collect the bread
|
||||
>>> todo.sh replace 4 "collect the bread"
|
||||
4 (A) collect the eggs
|
||||
TODO: Replaced task with:
|
||||
1 (A) collect the eggs
|
||||
4 (A) collect the bread
|
||||
|
||||
>>> todo.sh replace 4 collect the eggs
|
||||
4 (A) collect the bread
|
||||
TODO: Replaced task with:
|
||||
4 (A) collect the eggs
|
||||
EOF
|
||||
|
||||
echo 'jump on hay' > todo.txt
|
||||
test_todo_session 'replace with &' << EOF
|
||||
>>> todo.sh replace 1 "thrash the hay & thrash the wheat"
|
||||
1 jump on hay
|
||||
>>> todo.sh replace 3 "thrash the hay & thresh the wheat"
|
||||
3 jump on hay
|
||||
TODO: Replaced task with:
|
||||
1 thrash the hay & thrash the wheat
|
||||
3 thrash the hay & thresh the wheat
|
||||
EOF
|
||||
|
||||
echo 'jump on hay' > todo.txt
|
||||
test_todo_session 'replace with spaces' <<EOF
|
||||
>>> todo.sh replace 1 "notice the three spaces"
|
||||
1 jump on hay
|
||||
TODO: Replaced task with:
|
||||
1 notice the three spaces
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
smell the cows
|
||||
grow some corn
|
||||
thrash some hay
|
||||
chase the chickens
|
||||
EOF
|
||||
test_todo_session 'replace with symbols' <<EOF
|
||||
>>> todo.sh replace 1 "~@#$%^&*()-_=+[{]}|;:',<.>/?"
|
||||
1 smell the cows
|
||||
TODO: Replaced task with:
|
||||
1 ~@#$%^&*()-_=+[{]}|;:',<.>/?
|
||||
|
||||
>>> todo.sh replace 2 '\`!\\"'
|
||||
2 grow some corn
|
||||
TODO: Replaced task with:
|
||||
2 \`!\\"
|
||||
|
||||
>>> todo.sh list
|
||||
4 chase the chickens
|
||||
3 thrash some hay
|
||||
2 \`!\\"
|
||||
1 ~@#$%^&*()-_=+[{]}|;:',<.>/?
|
||||
--
|
||||
TODO: 4 of 4 tasks shown
|
||||
test_todo_session 'replace error' << EOF
|
||||
>>> todo.sh replace 10 "hej!"
|
||||
=== 1
|
||||
TODO: No task 10.
|
||||
EOF
|
||||
|
||||
cat /dev/null > todo.txt
|
||||
@@ -156,7 +124,6 @@ TODO: Replaced task with:
|
||||
1 (A) 2009-02-13 this is just a new one
|
||||
EOF
|
||||
|
||||
echo '(A) 2009-02-13 this is just a new one' > todo.txt
|
||||
test_todo_session 'replace with prepended date replaces existing date' <<EOF
|
||||
>>> todo.sh replace 1 2010-07-04 this also has a new date
|
||||
1 (A) 2009-02-13 this is just a new one
|
||||
|
||||
@@ -53,34 +53,9 @@ TODO: 2 prioritized (C).
|
||||
--
|
||||
TODO: 3 of 3 tasks shown
|
||||
|
||||
>>> todo.sh add "smell the coffee +wakeup"
|
||||
4 smell the coffee +wakeup
|
||||
TODO: 4 added.
|
||||
|
||||
>>> todo.sh -p list
|
||||
1 (B) smell the uppercase Roses +flowers @outside
|
||||
2 (C) notice the sunflowers
|
||||
4 smell the coffee +wakeup
|
||||
3 stop
|
||||
--
|
||||
TODO: 4 of 4 tasks shown
|
||||
EOF
|
||||
|
||||
test_todo_session 'priority error' <<EOF
|
||||
>>> todo.sh pri 10 B
|
||||
=== 1
|
||||
TODO: No task 10.
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
(B) smell the uppercase Roses +flowers @outside
|
||||
(C) notice the sunflowers
|
||||
stop
|
||||
EOF
|
||||
test_todo_session 'reprioritize' <<EOF
|
||||
>>> todo.sh pri 2 A
|
||||
2 (A) notice the sunflowers
|
||||
TODO: 2 re-prioritized from (C) to (A).
|
||||
TODO: 2 prioritized (A).
|
||||
|
||||
>>> todo.sh -p list
|
||||
2 (A) notice the sunflowers
|
||||
@@ -91,13 +66,25 @@ TODO: 3 of 3 tasks shown
|
||||
|
||||
>>> todo.sh pri 2 a
|
||||
2 (A) notice the sunflowers
|
||||
TODO: 2 already prioritized (A).
|
||||
TODO: 2 prioritized (A).
|
||||
|
||||
>>> todo.sh -p listpri
|
||||
2 (A) notice the sunflowers
|
||||
1 (B) smell the uppercase Roses +flowers @outside
|
||||
--
|
||||
TODO: 2 of 3 tasks shown
|
||||
|
||||
>>> todo.sh add "smell the coffee +wakeup"
|
||||
4 smell the coffee +wakeup
|
||||
TODO: 4 added.
|
||||
|
||||
>>> todo.sh -p list
|
||||
2 (A) notice the sunflowers
|
||||
1 (B) smell the uppercase Roses +flowers @outside
|
||||
4 smell the coffee +wakeup
|
||||
3 stop
|
||||
--
|
||||
TODO: 3 of 3 tasks shown
|
||||
TODO: 4 of 4 tasks shown
|
||||
EOF
|
||||
|
||||
test_done
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='list priority functionality
|
||||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
(B) smell the uppercase Roses +flowers @outside
|
||||
(C) notice the sunflowers
|
||||
stop
|
||||
EOF
|
||||
test_todo_session 'basic listpri' <<EOF
|
||||
>>> todo.sh listpri A
|
||||
--
|
||||
TODO: 0 of 3 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri c
|
||||
2 (C) notice the sunflowers
|
||||
--
|
||||
TODO: 1 of 3 tasks shown
|
||||
EOF
|
||||
|
||||
test_todo_session 'listpri highlighting' <<EOF
|
||||
>>> todo.sh listpri
|
||||
[0;32m1 (B) smell the uppercase Roses +flowers @outside[0m
|
||||
[1;34m2 (C) notice the sunflowers[0m
|
||||
--
|
||||
TODO: 2 of 3 tasks shown
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
(B) smell the uppercase Roses +flowers @outside
|
||||
(C) notice the sunflowers
|
||||
(m)others will notice this
|
||||
(n) not a prioritized task
|
||||
notice the (C)opyright
|
||||
EOF
|
||||
test_todo_session 'listpri filtering priorities' <<EOF
|
||||
>>> todo.sh -p listpri
|
||||
1 (B) smell the uppercase Roses +flowers @outside
|
||||
2 (C) notice the sunflowers
|
||||
--
|
||||
TODO: 2 of 5 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri b
|
||||
1 (B) smell the uppercase Roses +flowers @outside
|
||||
--
|
||||
TODO: 1 of 5 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri c
|
||||
2 (C) notice the sunflowers
|
||||
--
|
||||
TODO: 1 of 5 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri m
|
||||
--
|
||||
TODO: 0 of 5 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri n
|
||||
--
|
||||
TODO: 0 of 5 tasks shown
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
(B) smell the uppercase Roses +flowers @outside
|
||||
(X) clean the house from A-Z
|
||||
(C) notice the sunflowers
|
||||
(X) listen to music
|
||||
buy more records from artists A-Z
|
||||
EOF
|
||||
test_todo_session 'listpri filtering priority ranges' <<EOF
|
||||
>>> todo.sh -p listpri a-c
|
||||
1 (B) smell the uppercase Roses +flowers @outside
|
||||
3 (C) notice the sunflowers
|
||||
--
|
||||
TODO: 2 of 5 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri c-Z
|
||||
3 (C) notice the sunflowers
|
||||
2 (X) clean the house from A-Z
|
||||
4 (X) listen to music
|
||||
--
|
||||
TODO: 3 of 5 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri A-
|
||||
2 (X) clean the house from A-Z
|
||||
--
|
||||
TODO: 1 of 5 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri A-C A-Z
|
||||
--
|
||||
TODO: 0 of 5 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri X A-Z
|
||||
2 (X) clean the house from A-Z
|
||||
--
|
||||
TODO: 1 of 5 tasks shown
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
(B) ccc xxx this line should be third.
|
||||
ccc xxx this line should be third.
|
||||
(A) aaa zzz this line should be first.
|
||||
aaa zzz this line should be first.
|
||||
(B) bbb yyy this line should be second.
|
||||
bbb yyy this line should be second.
|
||||
EOF
|
||||
test_todo_session 'listpri filtering of TERM' <<EOF
|
||||
>>> todo.sh -p listpri "should be"
|
||||
3 (A) aaa zzz this line should be first.
|
||||
5 (B) bbb yyy this line should be second.
|
||||
1 (B) ccc xxx this line should be third.
|
||||
--
|
||||
TODO: 3 of 6 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri a "should be"
|
||||
3 (A) aaa zzz this line should be first.
|
||||
--
|
||||
TODO: 1 of 6 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri b second
|
||||
5 (B) bbb yyy this line should be second.
|
||||
--
|
||||
TODO: 1 of 6 tasks shown
|
||||
|
||||
>>> todo.sh -p listpri x "should be"
|
||||
--
|
||||
TODO: 0 of 6 tasks shown
|
||||
EOF
|
||||
|
||||
test_done
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='list project functionality
|
||||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
(B) smell the uppercase Roses +roses @outside +shared
|
||||
(C) notice the sunflowers +sunflowers @garden +shared +landscape
|
||||
stop
|
||||
EOF
|
||||
test_todo_session 'basic listproj' <<EOF
|
||||
>>> todo.sh listproj
|
||||
+landscape
|
||||
+roses
|
||||
+shared
|
||||
+sunflowers
|
||||
EOF
|
||||
|
||||
test_todo_session 'listproj with context' <<EOF
|
||||
>>> todo.sh listproj @garden
|
||||
+landscape
|
||||
+shared
|
||||
+sunflowers
|
||||
EOF
|
||||
|
||||
TEST_TODO_CUSTOM=todo-custom.cfg
|
||||
cat todo.cfg > "$TEST_TODO_CUSTOM"
|
||||
cat >> "$TEST_TODO_CUSTOM" <<'EOF'
|
||||
export DEFAULT='</color>'
|
||||
export PRI_B='<color type=green>'
|
||||
export PRI_C='<color type=blue>'
|
||||
export TODOTXT_FINAL_FILTER='grep -i roses'
|
||||
EOF
|
||||
test_todo_session 'listproj with context special cases' <<EOF
|
||||
>>> todo.sh -+ -d "$TEST_TODO_CUSTOM" listproj @garden
|
||||
+landscape
|
||||
+shared
|
||||
+sunflowers
|
||||
EOF
|
||||
|
||||
test_done
|
||||
@@ -53,18 +53,6 @@ test_todo_session 'checking TODOTXT_FINAL_FILTER' <<EOF
|
||||
TODO: 3 of 3 tasks shown
|
||||
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
|
||||
#
|
||||
@@ -85,29 +73,6 @@ TODO: 1 of 3 tasks shown
|
||||
TODO: 1 of 3 tasks shown
|
||||
EOF
|
||||
|
||||
#
|
||||
# check negative filtering via -TERM
|
||||
#
|
||||
test_todo_session 'checking negative filtering via -TERM' <<EOF
|
||||
>>> todo.sh ls -second
|
||||
2 aaa zzz this line should be first.
|
||||
1 ccc xxx this line should be third.
|
||||
--
|
||||
TODO: 2 of 3 tasks shown
|
||||
|
||||
>>> todo.sh ls "-should be f"
|
||||
3 bbb yyy this line should be second.
|
||||
1 ccc xxx this line should be third.
|
||||
--
|
||||
TODO: 2 of 3 tasks shown
|
||||
|
||||
>>> todo.sh ls "- zzz"
|
||||
3 bbb yyy this line should be second.
|
||||
1 ccc xxx this line should be third.
|
||||
--
|
||||
TODO: 2 of 3 tasks shown
|
||||
EOF
|
||||
|
||||
#
|
||||
# check the filtering of TERM with regexp
|
||||
#
|
||||
@@ -129,40 +94,6 @@ TODO: 1 of 3 tasks shown
|
||||
TODO: 1 of 3 tasks shown
|
||||
EOF
|
||||
|
||||
#
|
||||
# check the filtering of TERM containing characters that are special to the
|
||||
# shell, like variables, quotes, and multiple subsequent spaces.
|
||||
#
|
||||
cat > todo.txt <<'EOF'
|
||||
earn some pennies
|
||||
earn some $$
|
||||
earn some "money"
|
||||
get money from O'Brian
|
||||
just get money!
|
||||
EOF
|
||||
test_todo_session 'checking filtering of special characters' <<'EOF'
|
||||
>>> todo.sh ls '$$'
|
||||
2 earn some $$
|
||||
--
|
||||
TODO: 1 of 5 tasks shown
|
||||
|
||||
>>> todo.sh ls '"money"'
|
||||
3 earn some "money"
|
||||
--
|
||||
TODO: 1 of 5 tasks shown
|
||||
|
||||
>>> todo.sh ls "O'Brian"
|
||||
4 get money from O'Brian
|
||||
--
|
||||
TODO: 1 of 5 tasks shown
|
||||
|
||||
>>> todo.sh ls "get money"
|
||||
5 just get money!
|
||||
--
|
||||
TODO: 1 of 5 tasks shown
|
||||
EOF
|
||||
|
||||
|
||||
#
|
||||
# check the x command line option
|
||||
#
|
||||
@@ -211,7 +142,7 @@ cat > todo.txt <<EOF
|
||||
(D) @con02 +prj03 -- Some project 03 task, pri D
|
||||
(D) @con02 +prj04 -- Some project 04 task, pri D
|
||||
@con01 +prj01 -- Some project 01 task, no priority
|
||||
@con01 +prj02 -- Some project(S) 02 task, no priority
|
||||
@con01 +prj02 -- Some project 02 task, no priority
|
||||
@con02 +prj03 -- Some project 03 task, no priorty
|
||||
@con02 +prj04 -- Some project 04 task, no priority
|
||||
EOF
|
||||
@@ -234,7 +165,7 @@ test_todo_session 'plain mode option' <<EOF
|
||||
[1;37m15 (D) @con02 +prj03 -- Some project 03 task, pri D[0m
|
||||
[1;37m16 (D) @con02 +prj04 -- Some project 04 task, pri D[0m
|
||||
17 @con01 +prj01 -- Some project 01 task, no priority
|
||||
18 @con01 +prj02 -- Some project(S) 02 task, no priority
|
||||
18 @con01 +prj02 -- Some project 02 task, no priority
|
||||
19 @con02 +prj03 -- Some project 03 task, no priorty
|
||||
20 @con02 +prj04 -- Some project 04 task, no priority
|
||||
--
|
||||
@@ -258,7 +189,7 @@ TODO: 20 of 20 tasks shown
|
||||
15 (D) @con02 +prj03 -- Some project 03 task, pri D
|
||||
16 (D) @con02 +prj04 -- Some project 04 task, pri D
|
||||
17 @con01 +prj01 -- Some project 01 task, no priority
|
||||
18 @con01 +prj02 -- Some project(S) 02 task, no priority
|
||||
18 @con01 +prj02 -- Some project 02 task, no priority
|
||||
19 @con02 +prj03 -- Some project 03 task, no priorty
|
||||
20 @con02 +prj04 -- Some project 04 task, no priority
|
||||
--
|
||||
@@ -286,7 +217,7 @@ cat > todo.txt <<EOF
|
||||
(D) @con02 +prj03 -- Some project 03 task, pri D
|
||||
(D) @con02 +prj04 -- Some project 04 task, pri D
|
||||
@con01 +prj01 -- Some project 01 task, no priority
|
||||
@con01 +prj02 -- Some project(S) 02 task, no priority
|
||||
@con01 +prj02 -- Some project 02 task, no priority
|
||||
@con02 +prj03 -- Some project 03 task, no priorty
|
||||
@con02 +prj04 -- Some project 04 task, no priority
|
||||
EOF
|
||||
@@ -309,7 +240,7 @@ test_todo_session 'context, project, and priority suppression' <<EOF
|
||||
[1;37m15 (D) @con02 +prj03 -- Some project 03 task, pri D[0m
|
||||
[1;37m16 (D) @con02 +prj04 -- Some project 04 task, pri D[0m
|
||||
17 @con01 +prj01 -- Some project 01 task, no priority
|
||||
18 @con01 +prj02 -- Some project(S) 02 task, no priority
|
||||
18 @con01 +prj02 -- Some project 02 task, no priority
|
||||
19 @con02 +prj03 -- Some project 03 task, no priorty
|
||||
20 @con02 +prj04 -- Some project 04 task, no priority
|
||||
--
|
||||
@@ -325,7 +256,7 @@ TODO: 20 of 20 tasks shown
|
||||
[1;37m13 (D) @con01 +prj01 -- Some project 01 task, pri D[0m
|
||||
[1;37m14 (D) @con01 +prj02 -- Some project 02 task, pri D[0m
|
||||
17 @con01 +prj01 -- Some project 01 task, no priority
|
||||
18 @con01 +prj02 -- Some project(S) 02 task, no priority
|
||||
18 @con01 +prj02 -- Some project 02 task, no priority
|
||||
--
|
||||
TODO: 10 of 20 tasks shown
|
||||
|
||||
@@ -339,7 +270,7 @@ TODO: 10 of 20 tasks shown
|
||||
[1;37m13 @con01 +prj01 -- Some project 01 task, pri D[0m
|
||||
[1;37m14 @con01 +prj02 -- Some project 02 task, pri D[0m
|
||||
17 @con01 +prj01 -- Some project 01 task, no priority
|
||||
18 @con01 +prj02 -- Some project(S) 02 task, no priority
|
||||
18 @con01 +prj02 -- Some project 02 task, no priority
|
||||
--
|
||||
TODO: 10 of 20 tasks shown
|
||||
|
||||
@@ -353,7 +284,7 @@ TODO: 10 of 20 tasks shown
|
||||
[1;37m13 (D) @con01 -- Some project 01 task, pri D[0m
|
||||
[1;37m14 (D) @con01 -- Some project 02 task, pri D[0m
|
||||
17 @con01 -- Some project 01 task, no priority
|
||||
18 @con01 -- Some project(S) 02 task, no priority
|
||||
18 @con01 -- Some project 02 task, no priority
|
||||
--
|
||||
TODO: 10 of 20 tasks shown
|
||||
|
||||
@@ -367,7 +298,7 @@ TODO: 10 of 20 tasks shown
|
||||
[1;37m13 (D) +prj01 -- Some project 01 task, pri D[0m
|
||||
[1;37m14 (D) +prj02 -- Some project 02 task, pri D[0m
|
||||
17 +prj01 -- Some project 01 task, no priority
|
||||
18 +prj02 -- Some project(S) 02 task, no priority
|
||||
18 +prj02 -- Some project 02 task, no priority
|
||||
--
|
||||
TODO: 10 of 20 tasks shown
|
||||
|
||||
@@ -381,7 +312,7 @@ TODO: 10 of 20 tasks shown
|
||||
[1;37m13 +prj01 -- Some project 01 task, pri D[0m
|
||||
[1;37m14 +prj02 -- Some project 02 task, pri D[0m
|
||||
17 +prj01 -- Some project 01 task, no priority
|
||||
18 +prj02 -- Some project(S) 02 task, no priority
|
||||
18 +prj02 -- Some project 02 task, no priority
|
||||
--
|
||||
TODO: 10 of 20 tasks shown
|
||||
|
||||
@@ -395,7 +326,7 @@ TODO: 10 of 20 tasks shown
|
||||
[1;37m13 (D) @con01 +prj01 -- Some project 01 task, pri D[0m
|
||||
[1;37m14 (D) @con01 +prj02 -- Some project 02 task, pri D[0m
|
||||
17 @con01 +prj01 -- Some project 01 task, no priority
|
||||
18 @con01 +prj02 -- Some project(S) 02 task, no priority
|
||||
18 @con01 +prj02 -- Some project 02 task, no priority
|
||||
--
|
||||
TODO: 10 of 20 tasks shown
|
||||
|
||||
@@ -409,7 +340,7 @@ TODO: 10 of 20 tasks shown
|
||||
[1;37m13 -- Some project 01 task, pri D[0m
|
||||
[1;37m14 -- Some project 02 task, pri D[0m
|
||||
17 -- Some project 01 task, no priority
|
||||
18 -- Some project(S) 02 task, no priority
|
||||
18 -- Some project 02 task, no priority
|
||||
--
|
||||
TODO: 10 of 20 tasks shown
|
||||
EOF
|
||||
|
||||
@@ -166,20 +166,4 @@ test_todo_session 'highlighting with hidden contexts/projects' <<EOF
|
||||
TODO: 4 of 4 tasks shown
|
||||
EOF
|
||||
|
||||
# check that priorities are only matched at the start of the task
|
||||
#
|
||||
cat > todo.txt <<EOF
|
||||
(D) some prioritized task
|
||||
not prioritized
|
||||
should not be seen as PRIORITIZE(D) task
|
||||
EOF
|
||||
test_todo_session 'highlighting priority position' <<EOF
|
||||
>>> todo.sh ls
|
||||
[1;37m1 (D) some prioritized task[0m
|
||||
2 not prioritized
|
||||
3 should not be seen as PRIORITIZE(D) task
|
||||
--
|
||||
TODO: 3 of 3 tasks shown
|
||||
EOF
|
||||
|
||||
test_done
|
||||
|
||||
@@ -1,150 +0,0 @@
|
||||
#!/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
|
||||
@@ -57,34 +57,6 @@ test_todo_session 'prepend with &' <<EOF
|
||||
3 no running & jumping now stop
|
||||
EOF
|
||||
|
||||
echo 'jump on hay' > todo.txt
|
||||
test_todo_session 'prepend with spaces' <<EOF
|
||||
>>> todo.sh prepend 1 "notice the three spaces and"
|
||||
1 notice the three spaces and jump on hay
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
smell the cows
|
||||
grow some corn
|
||||
thrash some hay
|
||||
chase the chickens
|
||||
EOF
|
||||
test_todo_session 'prepend with symbols' <<EOF
|
||||
>>> todo.sh prepend 1 "~@#$%^&*()-_=+[{]}|;:',<.>/?"
|
||||
1 ~@#$%^&*()-_=+[{]}|;:',<.>/? smell the cows
|
||||
|
||||
>>> todo.sh prepend 2 '\`!\\"'
|
||||
2 \`!\\" grow some corn
|
||||
|
||||
>>> todo.sh list
|
||||
4 chase the chickens
|
||||
3 thrash some hay
|
||||
2 \`!\\" grow some corn
|
||||
1 ~@#$%^&*()-_=+[{]}|;:',<.>/? smell the cows
|
||||
--
|
||||
TODO: 4 of 4 tasks shown
|
||||
EOF
|
||||
|
||||
cat /dev/null > todo.txt
|
||||
test_todo_session 'prepend handling prepended date on add' <<EOF
|
||||
>>> todo.sh -t add "new task"
|
||||
|
||||
@@ -81,6 +81,6 @@ test_todo_session 'fail multiple do attempts' <<EOF
|
||||
TODO: 3 marked as done.
|
||||
|
||||
>>> todo.sh -a do 3
|
||||
TODO: 3 is already marked done.
|
||||
3 is already marked done
|
||||
EOF
|
||||
test_done
|
||||
|
||||
@@ -17,12 +17,6 @@ test_todo_session 'append usage' <<EOF
|
||||
usage: todo.sh append ITEM# "TEXT TO APPEND"
|
||||
EOF
|
||||
|
||||
test_todo_session 'append error' << EOF
|
||||
>>> todo.sh append 10 "hej!"
|
||||
=== 1
|
||||
TODO: No task 10.
|
||||
EOF
|
||||
|
||||
test_todo_session 'basic append' <<EOF
|
||||
>>> todo.sh append 1 "smell the roses"
|
||||
1 notice the daisies smell the roses
|
||||
@@ -43,32 +37,11 @@ test_todo_session 'basic append with &' <<EOF
|
||||
TODO: 1 of 1 tasks shown
|
||||
EOF
|
||||
|
||||
echo 'jump on hay' > todo.txt
|
||||
test_todo_session 'append with spaces' <<EOF
|
||||
>>> todo.sh append 1 "and notice the three spaces"
|
||||
1 jump on hay and notice the three spaces
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
smell the cows
|
||||
grow some corn
|
||||
thrash some hay
|
||||
chase the chickens
|
||||
EOF
|
||||
test_todo_session 'append with symbols' <<EOF
|
||||
>>> todo.sh append 1 "~@#$%^&*()-_=+[{]}|;:',<.>/?"
|
||||
1 smell the cows ~@#$%^&*()-_=+[{]}|;:',<.>/?
|
||||
|
||||
>>> todo.sh append 2 '\`!\\"'
|
||||
2 grow some corn \`!\\"
|
||||
|
||||
>>> todo.sh list
|
||||
4 chase the chickens
|
||||
2 grow some corn \`!\\"
|
||||
1 smell the cows ~@#$%^&*()-_=+[{]}|;:',<.>/?
|
||||
3 thrash some hay
|
||||
--
|
||||
TODO: 4 of 4 tasks shown
|
||||
test_todo_session 'append error' << EOF
|
||||
>>> todo.sh append 10 "hej!"
|
||||
=== 1
|
||||
TODO: No task 10.
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='archive functionality
|
||||
|
||||
Ensure we can archive items successfully.
|
||||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
one
|
||||
two
|
||||
three
|
||||
one
|
||||
x done
|
||||
four
|
||||
EOF
|
||||
|
||||
test_todo_session 'archive with duplicates' <<EOF
|
||||
>>> todo.sh archive
|
||||
x done
|
||||
TODO: $HOME/todo.txt archived.
|
||||
EOF
|
||||
|
||||
test_todo_session 'list after archive' <<EOF
|
||||
>>> todo.sh ls
|
||||
5 four
|
||||
1 one
|
||||
4 one
|
||||
3 three
|
||||
2 two
|
||||
--
|
||||
TODO: 5 of 5 tasks shown
|
||||
EOF
|
||||
|
||||
test_done
|
||||
@@ -1,103 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='deduplicate functionality
|
||||
|
||||
Ensure we can deduplicate items successfully.
|
||||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
duplicated
|
||||
two
|
||||
x done
|
||||
duplicated
|
||||
double task
|
||||
double task
|
||||
three
|
||||
EOF
|
||||
|
||||
test_todo_session 'deduplicate and preserve line numbers' <<EOF
|
||||
>>> todo.sh deduplicate
|
||||
TODO: 2 duplicate task(s) removed
|
||||
|
||||
>>> todo.sh -p ls
|
||||
5 double task
|
||||
1 duplicated
|
||||
7 three
|
||||
2 two
|
||||
3 x done
|
||||
--
|
||||
TODO: 5 of 5 tasks shown
|
||||
EOF
|
||||
|
||||
test_todo_session 'deduplicate without duplicates' <<EOF
|
||||
>>> todo.sh deduplicate
|
||||
TODO: No duplicate tasks found
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
duplicated
|
||||
two
|
||||
x done
|
||||
duplicated
|
||||
double task
|
||||
double task
|
||||
three
|
||||
EOF
|
||||
test_todo_session 'deduplicate and delete lines' <<EOF
|
||||
>>> todo.sh -n deduplicate
|
||||
TODO: 2 duplicate task(s) removed
|
||||
|
||||
>>> todo.sh -p ls
|
||||
4 double task
|
||||
1 duplicated
|
||||
5 three
|
||||
2 two
|
||||
3 x done
|
||||
--
|
||||
TODO: 5 of 5 tasks shown
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
one
|
||||
duplicated
|
||||
three
|
||||
duplicated
|
||||
duplicated
|
||||
six
|
||||
duplicated
|
||||
EOF
|
||||
test_todo_session 'deduplicate more than two occurrences' <<EOF
|
||||
>>> todo.sh deduplicate
|
||||
TODO: 3 duplicate task(s) removed
|
||||
|
||||
>>> todo.sh -p ls
|
||||
2 duplicated
|
||||
1 one
|
||||
6 six
|
||||
3 three
|
||||
--
|
||||
TODO: 4 of 4 tasks shown
|
||||
EOF
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
normal task
|
||||
a [1mbold[0m task
|
||||
something else
|
||||
a [1mbold[0m task
|
||||
something more
|
||||
EOF
|
||||
test_todo_session 'deduplicate with non-printable duplicates' <<EOF
|
||||
>>> todo.sh deduplicate
|
||||
TODO: 1 duplicate task(s) removed
|
||||
|
||||
>>> todo.sh -p ls
|
||||
2 a [1mbold[0m task
|
||||
1 normal task
|
||||
3 something else
|
||||
5 something more
|
||||
--
|
||||
TODO: 4 of 4 tasks shown
|
||||
EOF
|
||||
|
||||
test_done
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='report functionality
|
||||
|
||||
This test checks the reporting and the format of the report file.
|
||||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
cat > todo.txt <<EOF
|
||||
(B) smell the uppercase Roses +flowers @outside
|
||||
stop and think
|
||||
smell the coffee +wakeup
|
||||
make the coffee +wakeup
|
||||
visit http://example.com
|
||||
EOF
|
||||
|
||||
test_todo_session 'create new report' <<EOF
|
||||
>>> todo.sh report
|
||||
TODO: $HOME/todo.txt archived.
|
||||
2009-02-13T04:40:00 5 0
|
||||
TODO: Report file updated.
|
||||
|
||||
>>> todo.sh -p list
|
||||
1 (B) smell the uppercase Roses +flowers @outside
|
||||
4 make the coffee +wakeup
|
||||
3 smell the coffee +wakeup
|
||||
2 stop and think
|
||||
5 visit http://example.com
|
||||
--
|
||||
TODO: 5 of 5 tasks shown
|
||||
EOF
|
||||
|
||||
test_todo_session 'report of done tasks' <<EOF
|
||||
>>> todo.sh -A do 3
|
||||
3 x 2009-02-13 smell the coffee +wakeup
|
||||
TODO: 3 marked as done.
|
||||
x 2009-02-13 smell the coffee +wakeup
|
||||
TODO: $HOME/todo.txt archived.
|
||||
|
||||
>>> todo.sh report
|
||||
TODO: $HOME/todo.txt archived.
|
||||
2009-02-13T04:40:00 4 1
|
||||
TODO: Report file updated.
|
||||
|
||||
>>> todo.sh -p list
|
||||
1 (B) smell the uppercase Roses +flowers @outside
|
||||
3 make the coffee +wakeup
|
||||
2 stop and think
|
||||
4 visit http://example.com
|
||||
--
|
||||
TODO: 4 of 4 tasks shown
|
||||
EOF
|
||||
|
||||
test_todo_session 'report performs archiving' <<EOF
|
||||
>>> todo.sh -a do 3
|
||||
3 x 2009-02-13 make the coffee +wakeup
|
||||
TODO: 3 marked as done.
|
||||
|
||||
>>> todo.sh report
|
||||
x 2009-02-13 make the coffee +wakeup
|
||||
TODO: $HOME/todo.txt archived.
|
||||
2009-02-13T04:40:00 3 2
|
||||
TODO: Report file updated.
|
||||
|
||||
>>> todo.sh -p list
|
||||
1 (B) smell the uppercase Roses +flowers @outside
|
||||
2 stop and think
|
||||
3 visit http://example.com
|
||||
--
|
||||
TODO: 3 of 3 tasks shown
|
||||
|
||||
>>> todo.sh -p listfile done.txt
|
||||
2 x 2009-02-13 make the coffee +wakeup
|
||||
1 x 2009-02-13 smell the coffee +wakeup
|
||||
--
|
||||
DONE: 2 of 2 tasks shown
|
||||
EOF
|
||||
|
||||
test_todo_session 'report is unchanged when no changes' <<EOF
|
||||
>>> cat report.txt
|
||||
2009-02-13T04:40:00 5 0
|
||||
2009-02-13T04:40:00 4 1
|
||||
2009-02-13T04:40:00 3 2
|
||||
|
||||
>>> todo.sh report
|
||||
TODO: $HOME/todo.txt archived.
|
||||
2009-02-13T04:40:00 3 2
|
||||
TODO: Report file is up-to-date.
|
||||
|
||||
>>> cat report.txt
|
||||
2009-02-13T04:40:00 5 0
|
||||
2009-02-13T04:40:00 4 1
|
||||
2009-02-13T04:40:00 3 2
|
||||
EOF
|
||||
|
||||
test_done
|
||||
@@ -85,9 +85,13 @@ TODO: $HOME/todo.txt archived.
|
||||
TODO: 5 of 5 tasks shown
|
||||
|
||||
>>> todo.sh report
|
||||
TODO: $HOME/todo.txt archived.
|
||||
2009-02-13T04:40:00 5 1
|
||||
TODO: Report file updated.
|
||||
2009-02-13-04:40:00 5 1
|
||||
|
||||
>>> todo.sh report
|
||||
TODO: Report file updated.
|
||||
2009-02-13-04:40:00 5 1
|
||||
2009-02-13-04:40:00 5 1
|
||||
|
||||
>>> todo.sh append g a
|
||||
usage: todo.sh append ITEM# "TEXT TO APPEND"
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/bin/bash source-this-script
|
||||
[ "$BASH_VERSION" ] || return
|
||||
|
||||
_todo()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
local -r OPTS="-@ -@@ -+ -++ -d -f -h -p -P -PP -a -n -t -v -vv -V -x"
|
||||
local -r COMMANDS="\
|
||||
add a addto addm append app archive command del \
|
||||
rm depri dp do help list ls listall lsa listcon \
|
||||
lsc listfile lf listpri lsp listproj lsprj move \
|
||||
mv prepend prep pri p replace report shorthelp"
|
||||
|
||||
# Add custom commands from add-ons, if installed.
|
||||
# TODO: Filter for executable flag of files found in $TODO_ACTIONS_DIR.
|
||||
local allCommands="$COMMANDS $('ls' "${TODO_ACTIONS_DIR:-$HOME/.todo.actions.d}/" 2>/dev/null)"
|
||||
|
||||
local completions
|
||||
if [ $COMP_CWORD -eq 1 ]; then
|
||||
completions="$allCommands $OPTS"
|
||||
elif [[ $COMP_CWORD -gt 2 && ( \
|
||||
"${COMP_WORDS[COMP_CWORD-2]}" =~ ^(move|mv)$ || \
|
||||
"${COMP_WORDS[COMP_CWORD-3]}" =~ ^(move|mv)$ ) ]]; then
|
||||
# "move ITEM# DEST [SRC]" has file arguments on positions 2 and 3.
|
||||
completions=$(TODOTXT_VERBOSE=0 todo.sh command listfile)
|
||||
else
|
||||
case "$prev" in
|
||||
command)
|
||||
completions=$COMMANDS;;
|
||||
addto|listfile|lf)
|
||||
completions=$(TODOTXT_VERBOSE=0 todo.sh command listfile);;
|
||||
-*) completions="$allCommands $OPTS";;
|
||||
*) case "$cur" in
|
||||
+*) completions=$(TODOTXT_VERBOSE=0 todo.sh command listproj);;
|
||||
@*) completions=$(TODOTXT_VERBOSE=0 todo.sh command listcon);;
|
||||
*) if [[ "$cur" =~ ^[0-9]+$ ]]; then
|
||||
# Remove the (padded) task number; we prepend the
|
||||
# user-provided $cur instead.
|
||||
# Remove the timestamp prepended by the -t option,
|
||||
# and the done date (for done tasks); there's no
|
||||
# todo.txt option for that yet.
|
||||
# But keep priority and "x"; they're short and may
|
||||
# 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
|
||||
# completion can be a safety check before a
|
||||
# destructive todo.txt operation.
|
||||
[ "$todo" ] && COMPREPLY[0]="$cur # $todo"
|
||||
return 0
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
COMPREPLY=( $( compgen -W "$completions" -- $cur ))
|
||||
return 0
|
||||
}
|
||||
complete -F _todo todo.sh
|
||||
# If you define an alias (e.g. "t") to todo.sh, you need to explicitly enable
|
||||
# completion for it, too:
|
||||
#complete -F _todo t
|
||||
Reference in New Issue
Block a user