File: completion.patch

package info (click to toggle)
todotxt-cli 2.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,312 kB
  • sloc: sh: 5,393; makefile: 67
file content (274 lines) | stat: -rw-r--r-- 13,520 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
Description: Completion fixies after todo.sh->todo-txt renaming.
Author: Ondřej Nový <novy@ondrej.org>

--- a/tests/t6000-completion.sh
+++ b/tests/t6000-completion.sh
@@ -10,13 +10,13 @@
 readonly ACTIONS='add a addto addm append app archive command del rm depri dp do help list ls listaddons listall lsa listcon lsc listfile lf listpri lsp listproj lsprj move mv prepend prep pri p replace report shorthelp'
 readonly OPTIONS='-@ -@@ -+ -++ -d -f -h -p -P -PP -a -n -t -v -vv -V -x'
 
-test_todo_completion 'all arguments' 'todo.sh ' "$ACTIONS $OPTIONS"
-test_todo_completion 'arguments beginning with a' 'todo.sh a' 'add a addto addm append app archive'
-test_todo_completion 'all options' 'todo.sh -' "$OPTIONS"
-test_todo_completion 'all actions after command action' 'todo.sh command ' "$ACTIONS"
-test_todo_completion 'all arguments after option' 'todo.sh -a ' "$ACTIONS $OPTIONS"
-test_todo_completion 'all arguments after options' 'todo.sh -a -p ' "$ACTIONS $OPTIONS"
-test_todo_completion 'all options after options' 'todo.sh -a -p -' "$OPTIONS"
-test_todo_completion 'nothing after action' 'todo.sh archive ' ''
+test_todo_completion 'all arguments' 'todo-txt ' "$ACTIONS $OPTIONS"
+test_todo_completion 'arguments beginning with a' 'todo-txt a' 'add a addto addm append app archive'
+test_todo_completion 'all options' 'todo-txt -' "$OPTIONS"
+test_todo_completion 'all actions after command action' 'todo-txt command ' "$ACTIONS"
+test_todo_completion 'all arguments after option' 'todo-txt -a ' "$ACTIONS $OPTIONS"
+test_todo_completion 'all arguments after options' 'todo-txt -a -p ' "$ACTIONS $OPTIONS"
+test_todo_completion 'all options after options' 'todo-txt -a -p -' "$OPTIONS"
+test_todo_completion 'nothing after action' 'todo-txt archive ' ''
 
 test_done
--- a/tests/t6010-completion-contexts.sh
+++ b/tests/t6010-completion-contexts.sh
@@ -16,12 +16,12 @@
 x 2012-02-21 +herbs @oriental buy spices
 x 2012-02-21 +slack @home watch tv
 EOF
-test_todo_completion 'all contexts' 'todo.sh list @' '@garden @outdoor @outside'
-test_todo_completion 'contexts beginning with o' 'todo.sh list @o' '@outdoor @outside'
-test_todo_completion 'contexts beginning with outs' 'todo.sh list @outs' '@outside'
-test_todo_completion 'contexts beginning with x' 'todo.sh list @x' ''
+test_todo_completion 'all contexts' 'todo-txt list @' '@garden @outdoor @outside'
+test_todo_completion 'contexts beginning with o' 'todo-txt list @o' '@outdoor @outside'
+test_todo_completion 'contexts beginning with outs' 'todo-txt list @outs' '@outside'
+test_todo_completion 'contexts beginning with x' 'todo-txt list @x' ''
 
-test_todo_completion 'contexts from done tasks beginning with h' 'todo.sh list @h' '@home'
-test_todo_completion 'contexts from done tasks beginning with or' 'todo.sh list @or' '@oriental'
+test_todo_completion 'contexts from done tasks beginning with h' 'todo-txt list @h' '@home'
+test_todo_completion 'contexts from done tasks beginning with or' 'todo-txt list @or' '@oriental'
 
 test_done
--- a/tests/t6020-completion-projects.sh
+++ b/tests/t6020-completion-projects.sh
@@ -16,12 +16,12 @@
 x 2012-02-21 +herbs @oriental buy spices
 x 2012-02-21 +slack @home watch tv
 EOF
-test_todo_completion 'all projects' 'todo.sh list +' '+landscape +roses +shared +sunflowers'
-test_todo_completion 'projects beginning with s' 'todo.sh list +s' '+shared +sunflowers'
-test_todo_completion 'projects beginning with ro' 'todo.sh list +ro' '+roses'
-test_todo_completion 'projects beginning with x' 'todo.sh list +x' ''
+test_todo_completion 'all projects' 'todo-txt list +' '+landscape +roses +shared +sunflowers'
+test_todo_completion 'projects beginning with s' 'todo-txt list +s' '+shared +sunflowers'
+test_todo_completion 'projects beginning with ro' 'todo-txt list +ro' '+roses'
+test_todo_completion 'projects beginning with x' 'todo-txt list +x' ''
 
-test_todo_completion 'projects from done tasks beginning with h' 'todo.sh list +h' '+herbs'
-test_todo_completion 'projects from done tasks beginning with sl' 'todo.sh list +sl' '+slack'
+test_todo_completion 'projects from done tasks beginning with h' 'todo-txt list +h' '+herbs'
+test_todo_completion 'projects from done tasks beginning with sl' 'todo-txt list +sl' '+slack'
 
 test_done
--- a/tests/t6030-completion-tasks.sh
+++ b/tests/t6030-completion-tasks.sh
@@ -16,12 +16,12 @@
 x 2012-02-28 2012-02-21 +slack @home watch tv
 2012-02-28 +herbs buy cinnamon @grocer
 EOF
-test_todo_completion 'simple task' 'todo.sh list 1' '"1 # simple task"'
-test_todo_completion 'remove projects and contents from task' 'todo.sh list 2' '"2 # notice the sunflowers"'
-test_todo_completion 'keep priority' 'todo.sh list 3' '"3 # (B) smell the flower"'
-test_todo_completion 'keep priority and remove timestamp' 'todo.sh list 4' '"4 # (C) mow the lawn"'
-test_todo_completion 'keep done marker and remove done date' 'todo.sh list 5' '"5 # x buy spices"'
-test_todo_completion 'keep done marker and remove timestamp and done date' 'todo.sh list 6' '"6 # x watch tv"'
-test_todo_completion 'remove add date' 'todo.sh list 7' '"7 # buy cinnamon"'
+test_todo_completion 'simple task' 'todo-txt list 1' '"1 # simple task"'
+test_todo_completion 'remove projects and contents from task' 'todo-txt list 2' '"2 # notice the sunflowers"'
+test_todo_completion 'keep priority' 'todo-txt list 3' '"3 # (B) smell the flower"'
+test_todo_completion 'keep priority and remove timestamp' 'todo-txt list 4' '"4 # (C) mow the lawn"'
+test_todo_completion 'keep done marker and remove done date' 'todo-txt list 5' '"5 # x buy spices"'
+test_todo_completion 'keep done marker and remove timestamp and done date' 'todo-txt list 6' '"6 # x watch tv"'
+test_todo_completion 'remove add date' 'todo-txt list 7' '"7 # buy cinnamon"'
 
 test_done
--- a/tests/t6040-completion-files.sh
+++ b/tests/t6040-completion-files.sh
@@ -9,13 +9,13 @@
 
 > dummy.txt
 readonly FILES='done.txt dummy.txt report.txt todo.txt'
-test_todo_completion 'all files after addto' 'todo.sh addto ' "$FILES"
-test_todo_completion 'files beginning with d after addto' 'todo.sh addto d' 'done.txt dummy.txt'
-test_todo_completion 'all files after listfile' 'todo.sh listfile ' "$FILES"
-test_todo_completion 'all files after lf' 'todo.sh -v lf ' "$FILES"
-test_todo_completion 'nothing after move' 'todo.sh move ' ''
-test_todo_completion 'all files after move ITEM#' 'todo.sh move 1 ' "$FILES"
-test_todo_completion 'all files after mv ITEM#' 'todo.sh mv 1 ' "$FILES"
-test_todo_completion 'all files after move ITEM# DEST' 'todo.sh move 1 todo.sh ' "$FILES"
+test_todo_completion 'all files after addto' 'todo-txt addto ' "$FILES"
+test_todo_completion 'files beginning with d after addto' 'todo-txt addto d' 'done.txt dummy.txt'
+test_todo_completion 'all files after listfile' 'todo-txt listfile ' "$FILES"
+test_todo_completion 'all files after lf' 'todo-txt -v lf ' "$FILES"
+test_todo_completion 'nothing after move' 'todo-txt move ' ''
+test_todo_completion 'all files after move ITEM#' 'todo-txt move 1 ' "$FILES"
+test_todo_completion 'all files after mv ITEM#' 'todo-txt mv 1 ' "$FILES"
+test_todo_completion 'all files after move ITEM# DEST' 'todo-txt move 1 todo ' "$FILES"
 
 test_done
--- a/tests/t6050-completion-addons.sh
+++ b/tests/t6050-completion-addons.sh
@@ -64,11 +64,11 @@
 # Test resolution of the default TODO_ACTIONS_DIR.
 #
 makeCustomActions "$HOME/.todo.actions.d"
-test_todo_completion 'all arguments' 'todo.sh ' "$ACTIONS $ADDONS $CONTAINED $OPTIONS"
-test_todo_completion 'all arguments after option' 'todo.sh -a ' "$ACTIONS $ADDONS $CONTAINED $OPTIONS"
-test_todo_completion 'all arguments beginning with b' 'todo.sh b' 'bar baz'
-test_todo_completion 'all arguments beginning with f after options' 'todo.sh -a -v f' 'foobar'
-test_todo_completion 'nothing after addon action' 'todo.sh foobar ' ''
+test_todo_completion 'all arguments' 'todo-txt ' "$ACTIONS $ADDONS $CONTAINED $OPTIONS"
+test_todo_completion 'all arguments after option' 'todo-txt -a ' "$ACTIONS $ADDONS $CONTAINED $OPTIONS"
+test_todo_completion 'all arguments beginning with b' 'todo-txt b' 'bar baz'
+test_todo_completion 'all arguments beginning with f after options' 'todo-txt -a -v f' 'foobar'
+test_todo_completion 'nothing after addon action' 'todo-txt foobar ' ''
 removeCustomActions "$HOME/.todo.actions.d"
 
 #
@@ -76,7 +76,7 @@
 #
 mkdir  "$HOME/.todo"
 makeCustomActions "$HOME/.todo/actions"
-test_todo_completion 'all arguments with actions from .todo/actions/' 'todo.sh ' "$ACTIONS $ADDONS $CONTAINED $OPTIONS"
+test_todo_completion 'all arguments with actions from .todo/actions/' 'todo-txt ' "$ACTIONS $ADDONS $CONTAINED $OPTIONS"
 removeCustomActions "$HOME/.todo/actions"
 
 #
@@ -86,7 +86,7 @@
 cat >> todo.cfg <<'EOF'
 export TODO_ACTIONS_DIR="$HOME/addons"
 EOF
-test_todo_completion 'all arguments with actions from addons/' 'todo.sh ' "$ACTIONS $ADDONS $CONTAINED $OPTIONS"
+test_todo_completion 'all arguments with actions from addons/' 'todo-txt ' "$ACTIONS $ADDONS $CONTAINED $OPTIONS"
 removeCustomActions "$HOME/addons"
 
 test_done
--- a/tests/t6080-completion-path.sh
+++ b/tests/t6080-completion-path.sh
@@ -3,7 +3,7 @@
 
 test_description='Bash completion with different path functionality
 
-This test checks that todo_completion can use a different path to todo.sh when
+This test checks that todo_completion can use a different path to todo-txt when
 it is not accessible through PATH.
 '
 . ./test-lib.sh
@@ -14,7 +14,7 @@
 stop
 EOF
 
-mv bin/todo.sh bin/todo2.sh
+mv bin/todo-txt bin/todo2.sh
 test_expect_success 'todo2.sh executable' 'todo2.sh list'
 
 # Define a second completion function that injects the different executable. In
--- a/tests/t6090-completion-aliases.sh
+++ b/tests/t6090-completion-aliases.sh
@@ -4,7 +4,7 @@
 test_description='Bash completion with different aliases functionality
 
 This test checks that todo_completion can use a different configuration
-when another todo.sh alias is defined that uses that configuration.
+when another todo-txt alias is defined that uses that configuration.
 '
 . ./test-lib.sh
 
@@ -27,11 +27,11 @@
 # equivalent and work fine.
 todo1()
 {
-    todo.sh "$@"
+    todo-txt "$@"
 }
 todo2()
 {
-    todo.sh -d "$HOME/todo2.cfg" "$@"
+    todo-txt -d "$HOME/todo2.cfg" "$@"
 }
 
 # Ensure that the test fixture works as planned.
@@ -52,7 +52,7 @@
 #   complete -F _todo2 todo2
 _todo2()
 {
-    local _todo_sh='todo.sh -d "$HOME/todo2.cfg"'
+    local _todo_sh='todo-txt -d "$HOME/todo2.cfg"'
     _todo "$@"
 }
 
--- a/tests/t6100-completion-help.sh
+++ b/tests/t6100-completion-help.sh
@@ -13,8 +13,8 @@
 readonly ACTIONS='add a addto addm append app archive command del rm depri dp do help list ls listaddons listall lsa listcon lsc listfile lf listpri lsp listproj lsprj move mv prepend prep pri p replace report shorthelp'
 readonly ADDONS='aardvark zany'
 
-test_todo_completion 'all actions after help' 'todo.sh help ' "$ACTIONS $ADDONS"
-test_todo_completion 'all actions after command help' 'todo.sh command help ' "$ACTIONS $ADDONS"
-test_todo_completion 'actions beginning with a' 'todo.sh help a' 'add a addto addm append app archive aardvark'
+test_todo_completion 'all actions after help' 'todo-txt help ' "$ACTIONS $ADDONS"
+test_todo_completion 'all actions after command help' 'todo-txt command help ' "$ACTIONS $ADDONS"
+test_todo_completion 'actions beginning with a' 'todo-txt help a' 'add a addto addm append app archive aardvark'
 
 test_done
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -481,6 +481,7 @@
 	# Install latest todo.sh
 	mkdir bin
 	ln -s "$TEST_DIRECTORY/../todo.sh" bin/todo.sh
+	ln -s "$TEST_DIRECTORY/../todo.sh" bin/todo-txt
 
 	# Initialize a hack date script
 	TODO_TEST_REAL_DATE=$(which date)
--- a/todo_completion
+++ b/todo_completion
@@ -16,7 +16,7 @@
         mv prepend prep pri p replace report shorthelp"
     local -r MOVE_COMMAND_PATTERN='^(move|mv)$'
 
-    local _todo_sh=${_todo_sh:-todo.sh}
+    local _todo_sh=${_todo_sh:-todo-txt}
     local completions
     if [ $COMP_CWORD -eq 1 ]; then
         completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons 2>/dev/null) $OPTS"
@@ -83,16 +83,16 @@
     COMPREPLY=( $( compgen -W "$completions" -- $cur ))
     return 0
 }
-complete -F _todo todo.sh
+complete -F _todo todo-txt
 
-# If you define an alias (e.g. "t") to todo.sh, you need to explicitly enable
+# If you define an alias (e.g. "t") to todo-txt, you need to explicitly enable
 # completion for it, too:
 #complete -F _todo t
 # It is recommended to put this line next to your alias definition in your
 # ~/.bashrc (or wherever else you're defining your alias). If you simply
 # uncomment it here, you will need to redo this on every todo.txt update!
 
-# If you have renamed the todo.sh executable, or if it is not accessible through
+# If you have renamed the todo-txt executable, or if it is not accessible through
 # PATH, you need to add and use a wrapper completion function, like this:
 #_todoElsewhere()
 #{
@@ -104,10 +104,10 @@
 # If you use aliases to use different configuration(s), you need to add and use
 # a wrapper completion function for each configuration if you want to complete
 # from the actual configured task locations:
-#alias todo2='todo.sh -d "$HOME/todo2.cfg"'
+#alias todo2='todo-txt -d "$HOME/todo2.cfg"'
 #_todo2()
 #{
-#    local _todo_sh='todo.sh -d "$HOME/todo2.cfg"'
+#    local _todo_sh='todo-txt -d "$HOME/todo2.cfg"'
 #    _todo "$@"
 #}
 #complete -F _todo2 todo2