trctl 2.7.10

A transmission daemon CLI
Documentation
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
#compdef trctl

autoload -U is-at-least
_get_torrents() {
  local ret=1
  # TODO unless -- was given
  case "${line[1]}" in
    -*) ;;
    *)
      _cache_torrents=( ${(f)"$(trctl gen-torrents "${(kv)opt_args[@]}" "${line[@]}")"} ) || return 1
      # TODO handle fuzzy match corrections?
      if [[ "${line[@]}" == "" ]]; then
        _describe -V2 "torrents" _cache_torrents && ret=$?
      else
        _describe "torrents" _cache_torrents && ret=$?
      fi
      ;;
  esac
  return $ret
}

_trctl_query() {
  _arguments "${_arguments_options[@]}" : \
  '--finished=[Match finished]:FINISHED:(true false)' \
  '-s+[Sort the output]:SORT:(id name urate drate size)' \
  '--sort=[Sort the output]:SORT:(id name urate drate size)' \
  '*--ids=[Match ids]:IDS:_default' \
  '*--hsh=[Match hashes]:HSH:_default' \
  '*--trackers=[Match trackers]:TRACKERS:_default' \
  '*--status=[Match status(es)]:STATUS:(downloading queued-to-download queued-to-seed queued-to-verify seeding stopped verifying)' \
  '-u[Case sensitive search. Is also enabled with uppercase in the query]' \
  '--use-case[Case sensitive search. Is also enabled with uppercase in the query]' \
  '-e[Exact match on torrent or tracker name]' \
  '--exact[Exact match on torrent or tracker name]' \
  '--error[Match torrents with an error]' \
  '--complete[Match completed]' \
  '--incomplete[Match incomplete]' \
  '--move-aborted[Match completed that are still in dldir]' \
  '--moved[Match files not in dldir]' \
  '--cleanable[Match moved and finished torrents]' \
  '--files[Exact match on torrent name]' \
  '-r[Print in reverse]' \
  '--reverse[Print in reverse]' \
  '-h[Print help]' \
  '--help[Print help]' \
  '*::strs -- Query names:_get_torrents' \
  && ret=0
}

_trctl() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'-c+[Configuration file]:CONFIG:_files' \
'--config=[Configuration file]:CONFIG:_files' \
'*-v[Sen verbosity]' \
'*--verbose[Sen verbosity]' \
'--mock[Run with a mock rpc client]' \
'-y[Don'\''t ask for confirmation]' \
'--yes[Don'\''t ask for confirmation]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_trctl_commands" \
"*::: :->trctl" \
&& ret=0
    case $state in
    (trctl)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:trctl-command-$line[1]:"
        case $line[1] in
            (add)
_arguments "${_arguments_options[@]}" : \
'--dldir=[Download directory]:DLDIR:_files' \
'--existing[Whether the torrent already has files in the dldir]' \
'-h[Print help]' \
'--help[Print help]' \
'*::path -- Path to the torrent file:_files' \
&& ret=0
;;
(add-url)
_arguments "${_arguments_options[@]}" : \
'--dldir=[Download directory]:DLDIR:_files' \
'--existing[Whether the torrent already has files in the dldir]' \
'-h[Print help]' \
'--help[Print help]' \
'*::url -- Url to a torrent file or a magnet link:_default' \
&& ret=0
;;
(q|qu|que|quer|query|rm|erase|clean|start|stop|start-now|verify|reannounce|list-trackers)
  _trctl_query
;;
(set-location)
_arguments "${_arguments_options[@]}" : \
'--finished=[Match finished]:FINISHED:(true false)' \
'-s+[Sort the output]:SORT:(id name urate drate size)' \
'--sort=[Sort the output]:SORT:(id name urate drate size)' \
'*--ids=[Match ids]:IDS:_default' \
'*--hsh=[Match hashes]:HSH:_default' \
'*--trackers=[Match trackers]:TRACKERS:_default' \
'*--status=[Match status(es)]:STATUS:(downloading queued-to-download queued-to-seed queued-to-verify seeding stopped verifying)' \
'--location=[New location]:LOCATION:_files' \
'-u[Case sensitive search. Is also enabled with uppercase in the query]' \
'--use-case[Case sensitive search. Is also enabled with uppercase in the query]' \
'-e[Exact match on torrent or tracker name]' \
'--exact[Exact match on torrent or tracker name]' \
'--error[Match torrents with an error]' \
'--complete[Match completed]' \
'--incomplete[Match incomplete]' \
'--move-aborted[Match completed that are still in dldir]' \
'--moved[Match files not in dldir]' \
'--cleanable[Match moved and finished torrents]' \
'--files[Exact match on torrent name]' \
'-r[Print in reverse]' \
'--reverse[Print in reverse]' \
'--mv[Move files (or find them in a new location)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::strs -- Query names:_get_torrents' \
&& ret=0
;;
(mv)
_arguments "${_arguments_options[@]}" : \
'--finished=[Match finished]:FINISHED:(true false)' \
'-s+[Sort the output]:SORT:(id name urate drate size)' \
'--sort=[Sort the output]:SORT:(id name urate drate size)' \
'*--ids=[Match ids]:IDS:_default' \
'*--hsh=[Match hashes]:HSH:_default' \
'*--trackers=[Match trackers]:TRACKERS:_default' \
'*--status=[Match status(es)]:STATUS:(downloading queued-to-download queued-to-seed queued-to-verify seeding stopped verifying)' \
'-d+[Destination directory]:DESTINATION:_files' \
'--destination=[Destination directory]:DESTINATION:_files' \
'--verify=[Verify the files after move]:VERIFY:(true false)' \
'-u[Case sensitive search. Is also enabled with uppercase in the query]' \
'--use-case[Case sensitive search. Is also enabled with uppercase in the query]' \
'-e[Exact match on torrent or tracker name]' \
'--exact[Exact match on torrent or tracker name]' \
'--error[Match torrents with an error]' \
'--complete[Match completed]' \
'--incomplete[Match incomplete]' \
'--move-aborted[Match completed that are still in dldir]' \
'--moved[Match files not in dldir]' \
'--cleanable[Match moved and finished torrents]' \
'--files[Exact match on torrent name]' \
'-r[Print in reverse]' \
'--reverse[Print in reverse]' \
'-f[Move even if the destination directory is low on disk space]' \
'--force[Move even if the destination directory is low on disk space]' \
'-h[Print help]' \
'--help[Print help]' \
'*::strs -- Query names:_get_torrents' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_trctl__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:trctl-help-command-$line[1]:"
        case $line[1] in
            (add)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(add-url)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(query)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(rm)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(erase)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(clean)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(gen-completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(gen-torrents)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(set-location)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(mv)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(start)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(stop)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(start-now)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(reannounce)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(list-trackers)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_trctl_commands] )) ||
_trctl_commands() {
    local commands; commands=(
'add:Add torrent file' \
'add-url:Add magnet link or a torrent file from url' \
'query:Query torrents' \
'rm:Remove torrent and its data' \
'erase:Remove torrent but leave downloaded data in place' \
'clean:Clean finished torrents' \
'gen-completions:' \
'gen-torrents:' \
'set-location:Move torrents with the transmission rpc call' \
'mv:Move torrents' \
'start:Queue torrents' \
'stop:Stop torrents' \
'start-now:Start torrents without queuing' \
'verify:Verify torrents' \
'reannounce:Reannounce torrents' \
'list-trackers:List all trackers used by the torrents' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'trctl commands' commands "$@"
}
(( $+functions[_trctl__add_commands] )) ||
_trctl__add_commands() {
    local commands; commands=()
    _describe -t commands 'trctl add commands' commands "$@"
}
(( $+functions[_trctl__add-url_commands] )) ||
_trctl__add-url_commands() {
    local commands; commands=()
    _describe -t commands 'trctl add-url commands' commands "$@"
}
(( $+functions[_trctl__clean_commands] )) ||
_trctl__clean_commands() {
    local commands; commands=()
    _describe -t commands 'trctl clean commands' commands "$@"
}
(( $+functions[_trctl__erase_commands] )) ||
_trctl__erase_commands() {
    local commands; commands=()
    _describe -t commands 'trctl erase commands' commands "$@"
}
(( $+functions[_trctl__gen-completions_commands] )) ||
_trctl__gen-completions_commands() {
    local commands; commands=()
    _describe -t commands 'trctl gen-completions commands' commands "$@"
}
(( $+functions[_trctl__gen-torrents_commands] )) ||
_trctl__gen-torrents_commands() {
    local commands; commands=()
    _describe -t commands 'trctl gen-torrents commands' commands "$@"
}
(( $+functions[_trctl__help_commands] )) ||
_trctl__help_commands() {
    local commands; commands=(
'add:Add torrent file' \
'add-url:Add magnet link or a torrent file from url' \
'query:Query torrents' \
'rm:Remove torrent and its data' \
'erase:Remove torrent but leave downloaded data in place' \
'clean:Clean finished torrents' \
'gen-completions:' \
'gen-torrents:' \
'set-location:Move torrents with the transmission rpc call' \
'mv:Move torrents' \
'start:Queue torrents' \
'stop:Stop torrents' \
'start-now:Start torrents without queuing' \
'verify:Verify torrents' \
'reannounce:Reannounce torrents' \
'list-trackers:List all trackers used by the torrents' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'trctl help commands' commands "$@"
}
(( $+functions[_trctl__help__add_commands] )) ||
_trctl__help__add_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help add commands' commands "$@"
}
(( $+functions[_trctl__help__add-url_commands] )) ||
_trctl__help__add-url_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help add-url commands' commands "$@"
}
(( $+functions[_trctl__help__clean_commands] )) ||
_trctl__help__clean_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help clean commands' commands "$@"
}
(( $+functions[_trctl__help__erase_commands] )) ||
_trctl__help__erase_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help erase commands' commands "$@"
}
(( $+functions[_trctl__help__gen-completions_commands] )) ||
_trctl__help__gen-completions_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help gen-completions commands' commands "$@"
}
(( $+functions[_trctl__help__gen-torrents_commands] )) ||
_trctl__help__gen-torrents_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help gen-torrents commands' commands "$@"
}
(( $+functions[_trctl__help__help_commands] )) ||
_trctl__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help help commands' commands "$@"
}
(( $+functions[_trctl__help__list-trackers_commands] )) ||
_trctl__help__list-trackers_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help list-trackers commands' commands "$@"
}
(( $+functions[_trctl__help__mv_commands] )) ||
_trctl__help__mv_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help mv commands' commands "$@"
}
(( $+functions[_trctl__help__query_commands] )) ||
_trctl__help__query_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help query commands' commands "$@"
}
(( $+functions[_trctl__help__reannounce_commands] )) ||
_trctl__help__reannounce_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help reannounce commands' commands "$@"
}
(( $+functions[_trctl__help__rm_commands] )) ||
_trctl__help__rm_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help rm commands' commands "$@"
}
(( $+functions[_trctl__help__set-location_commands] )) ||
_trctl__help__set-location_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help set-location commands' commands "$@"
}
(( $+functions[_trctl__help__start_commands] )) ||
_trctl__help__start_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help start commands' commands "$@"
}
(( $+functions[_trctl__help__start-now_commands] )) ||
_trctl__help__start-now_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help start-now commands' commands "$@"
}
(( $+functions[_trctl__help__stop_commands] )) ||
_trctl__help__stop_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help stop commands' commands "$@"
}
(( $+functions[_trctl__help__verify_commands] )) ||
_trctl__help__verify_commands() {
    local commands; commands=()
    _describe -t commands 'trctl help verify commands' commands "$@"
}
(( $+functions[_trctl__list-trackers_commands] )) ||
_trctl__list-trackers_commands() {
    local commands; commands=()
    _describe -t commands 'trctl list-trackers commands' commands "$@"
}
(( $+functions[_trctl__mv_commands] )) ||
_trctl__mv_commands() {
    local commands; commands=()
    _describe -t commands 'trctl mv commands' commands "$@"
}
(( $+functions[_trctl__query_commands] )) ||
_trctl__query_commands() {
    local commands; commands=()
    _describe -t commands 'trctl query commands' commands "$@"
}
(( $+functions[_trctl__reannounce_commands] )) ||
_trctl__reannounce_commands() {
    local commands; commands=()
    _describe -t commands 'trctl reannounce commands' commands "$@"
}
(( $+functions[_trctl__rm_commands] )) ||
_trctl__rm_commands() {
    local commands; commands=()
    _describe -t commands 'trctl rm commands' commands "$@"
}
(( $+functions[_trctl__set-location_commands] )) ||
_trctl__set-location_commands() {
    local commands; commands=()
    _describe -t commands 'trctl set-location commands' commands "$@"
}
(( $+functions[_trctl__start_commands] )) ||
_trctl__start_commands() {
    local commands; commands=()
    _describe -t commands 'trctl start commands' commands "$@"
}
(( $+functions[_trctl__start-now_commands] )) ||
_trctl__start-now_commands() {
    local commands; commands=()
    _describe -t commands 'trctl start-now commands' commands "$@"
}
(( $+functions[_trctl__stop_commands] )) ||
_trctl__stop_commands() {
    local commands; commands=()
    _describe -t commands 'trctl stop commands' commands "$@"
}
(( $+functions[_trctl__verify_commands] )) ||
_trctl__verify_commands() {
    local commands; commands=()
    _describe -t commands 'trctl verify commands' commands "$@"
}

if [ "$funcstack[1]" = "_trctl" ]; then
    _trctl "$@"
else
    compdef _trctl trctl
fi