@nijaru/tk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,418 @@
1
+ export const BASH_COMPLETION = `# bash completion for tk
2
+
3
+ _tk_task_ids() {
4
+ local tasks_dir
5
+ tasks_dir="$(git rev-parse --show-toplevel 2>/dev/null)/.tasks"
6
+ if [[ -d "$tasks_dir" ]]; then
7
+ find "$tasks_dir" -maxdepth 1 -name '*.json' ! -name 'config.json' -exec basename {} .json \\; 2>/dev/null
8
+ fi
9
+ }
10
+
11
+ _tk() {
12
+ local cur prev words cword
13
+ _init_completion || return
14
+
15
+ local commands="init add ls list ready show start done reopen edit log block unblock rm remove clean config completions help"
16
+ local global_opts="--json --help -h --version -V"
17
+
18
+ # Find the command (first non-option word after 'tk')
19
+ local cmd=""
20
+ local i
21
+ for ((i=1; i < cword; i++)); do
22
+ if [[ \${words[i]} != -* ]]; then
23
+ cmd="\${words[i]}"
24
+ break
25
+ fi
26
+ done
27
+
28
+ # Complete command if no command yet
29
+ if [[ -z "$cmd" ]]; then
30
+ if [[ "$cur" == -* ]]; then
31
+ COMPREPLY=($(compgen -W "$global_opts" -- "$cur"))
32
+ else
33
+ COMPREPLY=($(compgen -W "$commands" -- "$cur"))
34
+ fi
35
+ return
36
+ fi
37
+
38
+ # Complete based on command
39
+ case "$cmd" in
40
+ add)
41
+ if [[ "$cur" == -* ]]; then
42
+ COMPREPLY=($(compgen -W "-p --priority -P --project -d --description -l --labels -A --assignees --parent --estimate --due --json" -- "$cur"))
43
+ elif [[ "$prev" == "-p" || "$prev" == "--priority" ]]; then
44
+ COMPREPLY=($(compgen -W "0 1 2 3 4 p0 p1 p2 p3 p4 none urgent high medium low" -- "$cur"))
45
+ fi
46
+ ;;
47
+ ls|list)
48
+ if [[ "$cur" == -* ]]; then
49
+ COMPREPLY=($(compgen -W "-s --status -p --priority -P --project -l --label -n --limit -a --all --assignee --parent --roots --overdue --json" -- "$cur"))
50
+ elif [[ "$prev" == "-s" || "$prev" == "--status" ]]; then
51
+ COMPREPLY=($(compgen -W "open active done" -- "$cur"))
52
+ elif [[ "$prev" == "-p" || "$prev" == "--priority" ]]; then
53
+ COMPREPLY=($(compgen -W "0 1 2 3 4 p0 p1 p2 p3 p4 none urgent high medium low" -- "$cur"))
54
+ fi
55
+ ;;
56
+ show|start|done|reopen|rm|remove)
57
+ if [[ "$cur" == -* ]]; then
58
+ COMPREPLY=($(compgen -W "--json" -- "$cur"))
59
+ else
60
+ COMPREPLY=($(compgen -W "$(_tk_task_ids)" -- "$cur"))
61
+ fi
62
+ ;;
63
+ edit)
64
+ if [[ "$cur" == -* ]]; then
65
+ COMPREPLY=($(compgen -W "-t --title -d --description -p --priority -l --labels -A --assignees --parent --estimate --due --json" -- "$cur"))
66
+ elif [[ "$prev" == "-p" || "$prev" == "--priority" ]]; then
67
+ COMPREPLY=($(compgen -W "0 1 2 3 4 p0 p1 p2 p3 p4 none urgent high medium low" -- "$cur"))
68
+ else
69
+ COMPREPLY=($(compgen -W "$(_tk_task_ids)" -- "$cur"))
70
+ fi
71
+ ;;
72
+ log)
73
+ if [[ "$cur" == -* ]]; then
74
+ COMPREPLY=($(compgen -W "--json" -- "$cur"))
75
+ else
76
+ COMPREPLY=($(compgen -W "$(_tk_task_ids)" -- "$cur"))
77
+ fi
78
+ ;;
79
+ block|unblock)
80
+ if [[ "$cur" == -* ]]; then
81
+ COMPREPLY=($(compgen -W "--json" -- "$cur"))
82
+ else
83
+ COMPREPLY=($(compgen -W "$(_tk_task_ids)" -- "$cur"))
84
+ fi
85
+ ;;
86
+ clean)
87
+ if [[ "$cur" == -* ]]; then
88
+ COMPREPLY=($(compgen -W "--older-than --done -a --all --json" -- "$cur"))
89
+ fi
90
+ ;;
91
+ config)
92
+ if [[ "$prev" == "config" ]]; then
93
+ COMPREPLY=($(compgen -W "project alias --rm" -- "$cur"))
94
+ elif [[ "$prev" == "alias" ]]; then
95
+ COMPREPLY=($(compgen -W "--rm" -- "$cur"))
96
+ fi
97
+ ;;
98
+ init)
99
+ if [[ "$cur" == -* ]]; then
100
+ COMPREPLY=($(compgen -W "-P --project --json" -- "$cur"))
101
+ fi
102
+ ;;
103
+ completions)
104
+ COMPREPLY=($(compgen -W "bash zsh fish" -- "$cur"))
105
+ ;;
106
+ ready|help)
107
+ if [[ "$cur" == -* ]]; then
108
+ COMPREPLY=($(compgen -W "--json" -- "$cur"))
109
+ fi
110
+ ;;
111
+ esac
112
+ }
113
+
114
+ complete -F _tk tk`;
115
+
116
+ export const ZSH_COMPLETION = `#compdef tk
117
+
118
+ _tk_task_ids() {
119
+ local tasks_dir
120
+ tasks_dir="$(git rev-parse --show-toplevel 2>/dev/null)/.tasks"
121
+ if [[ -d "$tasks_dir" ]]; then
122
+ compadd -- \${(f)"$(find "$tasks_dir" -maxdepth 1 -name '*.json' ! -name 'config.json' -exec basename {} .json \\; 2>/dev/null)"}
123
+ fi
124
+ }
125
+
126
+ _tk() {
127
+ local -a commands
128
+ commands=(
129
+ 'init:Initialize .tasks/ directory'
130
+ 'add:Create task'
131
+ 'ls:List tasks'
132
+ 'list:List tasks'
133
+ 'ready:List ready tasks (open + unblocked)'
134
+ 'show:Show task details'
135
+ 'start:Start working on task'
136
+ 'done:Complete task'
137
+ 'reopen:Reopen task'
138
+ 'edit:Edit task'
139
+ 'log:Add log entry'
140
+ 'block:Add blocker'
141
+ 'unblock:Remove blocker'
142
+ 'rm:Delete task'
143
+ 'remove:Delete task'
144
+ 'clean:Remove old done tasks'
145
+ 'config:Show/set configuration'
146
+ 'completions:Output shell completions'
147
+ 'help:Show help'
148
+ )
149
+
150
+ local -a global_opts
151
+ global_opts=(
152
+ '--json[Output as JSON]'
153
+ '(-h --help)'{-h,--help}'[Show help]'
154
+ '(-V --version)'{-V,--version}'[Show version]'
155
+ )
156
+
157
+ local -a statuses
158
+ statuses=('open' 'active' 'done')
159
+
160
+ local -a priorities
161
+ priorities=('0' '1' '2' '3' '4' 'p0' 'p1' 'p2' 'p3' 'p4' 'none' 'urgent' 'high' 'medium' 'low')
162
+
163
+ local -a shells
164
+ shells=('bash' 'zsh' 'fish')
165
+
166
+ _arguments -C \\
167
+ \$global_opts \\
168
+ '1:command:->command' \\
169
+ '*::arg:->args'
170
+
171
+ case \$state in
172
+ command)
173
+ _describe -t commands 'tk command' commands
174
+ ;;
175
+ args)
176
+ case \$words[1] in
177
+ add)
178
+ _arguments \\
179
+ '(-p --priority)'{-p,--priority}'[Priority]:priority:(\$priorities)' \\
180
+ '(-P --project)'{-P,--project}'[Project]:project:' \\
181
+ '(-d --description)'{-d,--description}'[Description]:description:' \\
182
+ '(-l --labels)'{-l,--labels}'[Labels]:labels:' \\
183
+ '(-A --assignees)'{-A,--assignees}'[Assignees]:assignees:' \\
184
+ '--parent[Parent task]:parent:_tk_task_ids' \\
185
+ '--estimate[Estimate]:estimate:' \\
186
+ '--due[Due date]:due:' \\
187
+ '--json[Output as JSON]' \\
188
+ '*:title:'
189
+ ;;
190
+ ls|list)
191
+ _arguments \\
192
+ '(-s --status)'{-s,--status}'[Status]:status:(\$statuses)' \\
193
+ '(-p --priority)'{-p,--priority}'[Priority]:priority:(\$priorities)' \\
194
+ '(-P --project)'{-P,--project}'[Project]:project:' \\
195
+ '(-l --label)'{-l,--label}'[Label]:label:' \\
196
+ '--assignee[Assignee]:assignee:' \\
197
+ '--parent[Parent]:parent:_tk_task_ids' \\
198
+ '--roots[Root tasks only]' \\
199
+ '--overdue[Overdue only]' \\
200
+ '(-n --limit)'{-n,--limit}'[Limit]:limit:' \\
201
+ '(-a --all)'{-a,--all}'[Show all]' \\
202
+ '--json[Output as JSON]'
203
+ ;;
204
+ show|start|done|reopen|rm|remove)
205
+ _arguments \\
206
+ '--json[Output as JSON]' \\
207
+ '1:task id:_tk_task_ids'
208
+ ;;
209
+ edit)
210
+ _arguments \\
211
+ '(-t --title)'{-t,--title}'[Title]:title:' \\
212
+ '(-d --description)'{-d,--description}'[Description]:description:' \\
213
+ '(-p --priority)'{-p,--priority}'[Priority]:priority:(\$priorities)' \\
214
+ '(-l --labels)'{-l,--labels}'[Labels]:labels:' \\
215
+ '(-A --assignees)'{-A,--assignees}'[Assignees]:assignees:' \\
216
+ '--parent[Parent task]:parent:' \\
217
+ '--estimate[Estimate]:estimate:' \\
218
+ '--due[Due date]:due:' \\
219
+ '--json[Output as JSON]' \\
220
+ '1:task id:_tk_task_ids'
221
+ ;;
222
+ log)
223
+ _arguments \\
224
+ '--json[Output as JSON]' \\
225
+ '1:task id:_tk_task_ids' \\
226
+ '*:message:'
227
+ ;;
228
+ block|unblock)
229
+ _arguments \\
230
+ '--json[Output as JSON]' \\
231
+ '1:task id:_tk_task_ids' \\
232
+ '2:blocker id:_tk_task_ids'
233
+ ;;
234
+ clean)
235
+ _arguments \\
236
+ '--older-than[Duration]:duration:' \\
237
+ '--done[Only done tasks]' \\
238
+ '(-a --all)'{-a,--all}'[All statuses]' \\
239
+ '--json[Output as JSON]'
240
+ ;;
241
+ config)
242
+ _arguments \\
243
+ '--rm[Remove alias]' \\
244
+ '1:subcommand:(project alias)'
245
+ ;;
246
+ init)
247
+ _arguments \\
248
+ '(-P --project)'{-P,--project}'[Project]:project:' \\
249
+ '--json[Output as JSON]'
250
+ ;;
251
+ completions)
252
+ _arguments \\
253
+ '1:shell:(\$shells)'
254
+ ;;
255
+ ready|help)
256
+ _arguments \\
257
+ '--json[Output as JSON]'
258
+ ;;
259
+ esac
260
+ ;;
261
+ esac
262
+ }
263
+
264
+ _tk "$@"`;
265
+
266
+ export const FISH_COMPLETION = `# fish completion for tk
267
+
268
+ function __tk_task_ids
269
+ set -l tasks_dir (git rev-parse --show-toplevel 2>/dev/null)/.tasks
270
+ if test -d "$tasks_dir"
271
+ for f in $tasks_dir/*.json
272
+ set -l name (basename $f .json)
273
+ if test "$name" != "config"
274
+ echo $name
275
+ end
276
+ end
277
+ end
278
+ end
279
+
280
+ function __tk_needs_command
281
+ set -l cmd (commandline -opc)
282
+ if test (count $cmd) -eq 1
283
+ return 0
284
+ end
285
+ for i in $cmd[2..-1]
286
+ switch $i
287
+ case '-*'
288
+ continue
289
+ case '*'
290
+ return 1
291
+ end
292
+ end
293
+ return 0
294
+ end
295
+
296
+ function __tk_using_command
297
+ set -l cmd (commandline -opc)
298
+ for i in $cmd[2..-1]
299
+ switch $i
300
+ case '-*'
301
+ continue
302
+ case '*'
303
+ if test "$i" = "$argv[1]"
304
+ return 0
305
+ end
306
+ return 1
307
+ end
308
+ end
309
+ return 1
310
+ end
311
+
312
+ # Global options
313
+ complete -c tk -n __tk_needs_command -l json -d 'Output as JSON'
314
+ complete -c tk -n __tk_needs_command -s h -l help -d 'Show help'
315
+ complete -c tk -n __tk_needs_command -s V -l version -d 'Show version'
316
+
317
+ # Commands
318
+ complete -c tk -n __tk_needs_command -f -a init -d 'Initialize .tasks/ directory'
319
+ complete -c tk -n __tk_needs_command -f -a add -d 'Create task'
320
+ complete -c tk -n __tk_needs_command -f -a ls -d 'List tasks'
321
+ complete -c tk -n __tk_needs_command -f -a list -d 'List tasks'
322
+ complete -c tk -n __tk_needs_command -f -a ready -d 'List ready tasks (open + unblocked)'
323
+ complete -c tk -n __tk_needs_command -f -a show -d 'Show task details'
324
+ complete -c tk -n __tk_needs_command -f -a start -d 'Start working on task'
325
+ complete -c tk -n __tk_needs_command -f -a done -d 'Complete task'
326
+ complete -c tk -n __tk_needs_command -f -a reopen -d 'Reopen task'
327
+ complete -c tk -n __tk_needs_command -f -a edit -d 'Edit task'
328
+ complete -c tk -n __tk_needs_command -f -a log -d 'Add log entry'
329
+ complete -c tk -n __tk_needs_command -f -a block -d 'Add blocker'
330
+ complete -c tk -n __tk_needs_command -f -a unblock -d 'Remove blocker'
331
+ complete -c tk -n __tk_needs_command -f -a rm -d 'Delete task'
332
+ complete -c tk -n __tk_needs_command -f -a remove -d 'Delete task'
333
+ complete -c tk -n __tk_needs_command -f -a clean -d 'Remove old done tasks'
334
+ complete -c tk -n __tk_needs_command -f -a config -d 'Show/set configuration'
335
+ complete -c tk -n __tk_needs_command -f -a completions -d 'Output shell completions'
336
+ complete -c tk -n __tk_needs_command -f -a help -d 'Show help'
337
+
338
+ # add command options
339
+ complete -c tk -n '__tk_using_command add' -s p -l priority -d 'Priority' -xa '0 1 2 3 4 p0 p1 p2 p3 p4 none urgent high medium low'
340
+ complete -c tk -n '__tk_using_command add' -s P -l project -d 'Project'
341
+ complete -c tk -n '__tk_using_command add' -s d -l description -d 'Description'
342
+ complete -c tk -n '__tk_using_command add' -s l -l labels -d 'Labels'
343
+ complete -c tk -n '__tk_using_command add' -s A -l assignees -d 'Assignees'
344
+ complete -c tk -n '__tk_using_command add' -l parent -d 'Parent task'
345
+ complete -c tk -n '__tk_using_command add' -l estimate -d 'Estimate'
346
+ complete -c tk -n '__tk_using_command add' -l due -d 'Due date'
347
+ complete -c tk -n '__tk_using_command add' -l json -d 'Output as JSON'
348
+
349
+ # ls/list command options
350
+ complete -c tk -n '__tk_using_command ls' -s s -l status -d 'Status' -xa 'open active done'
351
+ complete -c tk -n '__tk_using_command list' -s s -l status -d 'Status' -xa 'open active done'
352
+ complete -c tk -n '__tk_using_command ls' -s p -l priority -d 'Priority' -xa '0 1 2 3 4 p0 p1 p2 p3 p4 none urgent high medium low'
353
+ complete -c tk -n '__tk_using_command list' -s p -l priority -d 'Priority' -xa '0 1 2 3 4 p0 p1 p2 p3 p4 none urgent high medium low'
354
+ complete -c tk -n '__tk_using_command ls' -s P -l project -d 'Project'
355
+ complete -c tk -n '__tk_using_command list' -s P -l project -d 'Project'
356
+ complete -c tk -n '__tk_using_command ls' -s l -l label -d 'Label'
357
+ complete -c tk -n '__tk_using_command list' -s l -l label -d 'Label'
358
+ complete -c tk -n '__tk_using_command ls' -l assignee -d 'Assignee'
359
+ complete -c tk -n '__tk_using_command list' -l assignee -d 'Assignee'
360
+ complete -c tk -n '__tk_using_command ls' -l parent -d 'Parent'
361
+ complete -c tk -n '__tk_using_command list' -l parent -d 'Parent'
362
+ complete -c tk -n '__tk_using_command ls' -l roots -d 'Root tasks only'
363
+ complete -c tk -n '__tk_using_command list' -l roots -d 'Root tasks only'
364
+ complete -c tk -n '__tk_using_command ls' -l overdue -d 'Overdue only'
365
+ complete -c tk -n '__tk_using_command list' -l overdue -d 'Overdue only'
366
+ complete -c tk -n '__tk_using_command ls' -s n -l limit -d 'Limit'
367
+ complete -c tk -n '__tk_using_command list' -s n -l limit -d 'Limit'
368
+ complete -c tk -n '__tk_using_command ls' -s a -l all -d 'Show all'
369
+ complete -c tk -n '__tk_using_command list' -s a -l all -d 'Show all'
370
+ complete -c tk -n '__tk_using_command ls' -l json -d 'Output as JSON'
371
+ complete -c tk -n '__tk_using_command list' -l json -d 'Output as JSON'
372
+
373
+ # Commands that take task ID
374
+ complete -c tk -n '__tk_using_command show' -f -a '(__tk_task_ids)' -d 'Task ID'
375
+ complete -c tk -n '__tk_using_command start' -f -a '(__tk_task_ids)' -d 'Task ID'
376
+ complete -c tk -n '__tk_using_command done' -f -a '(__tk_task_ids)' -d 'Task ID'
377
+ complete -c tk -n '__tk_using_command reopen' -f -a '(__tk_task_ids)' -d 'Task ID'
378
+ complete -c tk -n '__tk_using_command rm' -f -a '(__tk_task_ids)' -d 'Task ID'
379
+ complete -c tk -n '__tk_using_command remove' -f -a '(__tk_task_ids)' -d 'Task ID'
380
+ complete -c tk -n '__tk_using_command log' -f -a '(__tk_task_ids)' -d 'Task ID'
381
+
382
+ # edit command
383
+ complete -c tk -n '__tk_using_command edit' -f -a '(__tk_task_ids)' -d 'Task ID'
384
+ complete -c tk -n '__tk_using_command edit' -s t -l title -d 'Title'
385
+ complete -c tk -n '__tk_using_command edit' -s d -l description -d 'Description'
386
+ complete -c tk -n '__tk_using_command edit' -s p -l priority -d 'Priority' -xa '0 1 2 3 4 p0 p1 p2 p3 p4 none urgent high medium low'
387
+ complete -c tk -n '__tk_using_command edit' -s l -l labels -d 'Labels'
388
+ complete -c tk -n '__tk_using_command edit' -s A -l assignees -d 'Assignees'
389
+ complete -c tk -n '__tk_using_command edit' -l parent -d 'Parent task'
390
+ complete -c tk -n '__tk_using_command edit' -l estimate -d 'Estimate'
391
+ complete -c tk -n '__tk_using_command edit' -l due -d 'Due date'
392
+ complete -c tk -n '__tk_using_command edit' -l json -d 'Output as JSON'
393
+
394
+ # block/unblock commands
395
+ complete -c tk -n '__tk_using_command block' -f -a '(__tk_task_ids)' -d 'Task ID'
396
+ complete -c tk -n '__tk_using_command block' -l json -d 'Output as JSON'
397
+ complete -c tk -n '__tk_using_command unblock' -f -a '(__tk_task_ids)' -d 'Task ID'
398
+ complete -c tk -n '__tk_using_command unblock' -l json -d 'Output as JSON'
399
+
400
+ # log command
401
+ complete -c tk -n '__tk_using_command log' -l json -d 'Output as JSON'
402
+
403
+ # clean command
404
+ complete -c tk -n '__tk_using_command clean' -l older-than -d 'Duration (e.g., 7d, 24h)'
405
+ complete -c tk -n '__tk_using_command clean' -l done -d 'Only done tasks'
406
+ complete -c tk -n '__tk_using_command clean' -s a -l all -d 'All statuses'
407
+ complete -c tk -n '__tk_using_command clean' -l json -d 'Output as JSON'
408
+
409
+ # config command
410
+ complete -c tk -n '__tk_using_command config' -f -a 'project alias' -d 'Config option'
411
+ complete -c tk -n '__tk_using_command config' -l rm -d 'Remove alias'
412
+
413
+ # init command
414
+ complete -c tk -n '__tk_using_command init' -s P -l project -d 'Project'
415
+ complete -c tk -n '__tk_using_command init' -l json -d 'Output as JSON'
416
+
417
+ # completions command
418
+ complete -c tk -n '__tk_using_command completions' -f -a 'bash zsh fish' -d 'Shell'`;