aboutsummaryrefslogtreecommitdiff
path: root/zsh-completion/_cave
blob: 7067fa869eb6d0e3e37eafa16c6dc7bc7a389c2b (plain)
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
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
#compdef cave

# vim: set et sw=2 sts=2 ts=2 ft=zsh :
# ZSH completion for `cave`
# Written by Ingmar Vanhassel <ingmar@exherbo.org>
# Updated by Bo ├śrsted Andresen <zlin@exherbo.org>

_cave()
{
  local -a _cave_arguments _cave_commands
  local cmd

  _cave_arguments=(
    '(-E --environment)'{-E,--environment}'[Environment specification]:environment specification: '
    '(--log-level -L)'{--log-level,-L}'[Specify the log level]:log level:((debug\:"Show debug output (noisy)"
                                                                               d\:"Show debug output (noisy)"
                                                                              qa\:"Show QA messages and warnings only (default)"
                                                                               q\:"Show QA messages and warnings only (default)"
                                                                         warning\:"Show warnings only"
                                                                               w\:"Show warnings only"
                                                                          silent\:"Suppress all log messages (UNSAFE)"
                                                                               s\:"Suppress all log messages (UNSAFE)"))'
    '(--colour -c)'{--colour,-c}'[Specify whether to use colour]:When:((auto a yes y no n))'
    '(--help -h)'{--help,-h}'[Display help messsage]'
    '(-v --version)'{-v,--version}'[Display version information]'
  )

  _cave_commands=(
    'config:Perform post-install configuration on a package'
    'contents:Display the contents of a package ID'
    'digest:Generates a digest file for a particular package in a particular repository'
    "display-resolution:Displays a dependency resolution created using \'cave resolve\'"
    'dump-cave-formats-conf:Output a ~/.cave/formats.conf'
    'executables:Display executables belonging to an ID'
    "execute-resolution:Executes a dependency resolution created using \'cave resolve\'"
    'find-candidates:Find a list of candidate packages for a search'
    'fix-cache:Fix on-disk caches'
    'fix-linkage:Identify packages with broken linkage that can be fixed by rebuilds'
    'generate-metadata:Pregenerate metadata for a set of IDs'
    "graph-jobs:Creates a Graphviz graph for jobs in a resolution created using \'cave resolve\'"
    'has-version:Returns success if there is an installed package matching a particular spec'
    'help:Display help information'
    'import:Import a package from a directory containing its image'
    'info:Display a summary of configuration and package information'
    'manage-search-index:Manages a search index for use by cave search'
    'match:Determine whether a particular package version has certain properties'
    'mirror:Fetches files for a set of IDs'
    'owner:Shows package IDs owning a given file'
    'perform:Perform an action upon a package'
    'print-best-version:Prints the best installed version matching a particular spec'
    'print-categories:Prints a list of known categories'
    'print-commands:Prints a list of known cave commands'
    'print-dependent-ids:Prints a list of installed IDs that are dependent upon another installed ID'
    'print-environment-metadata:Prints environment metadata'
    'print-id-actions:Prints ID actions'
    'print-id-contents:Prints the contents of a package ID'
    'print-id-environment-variable:Prints ID environment variables'
    'print-id-executables:Prints a list of executables belonging to an ID'
    'print-id-masks:Prints ID masks'
    'print-id-metadata:Prints ID metadata'
    'print-id-size:Prints the size of files installed by a package, in a parsable format'
    'print-ids:Prints a list of known IDs'
    'print-owners:Prints a list of package IDs owning a given file'
    'print-packages:Prints a list of package names'
    'print-repositories:Prints a list of repositories'
    'print-repository-formats:Prints a list of available repository formats'
    'print-repository-metadata:Prints repository metadata'
    'print-set:Prints a list of known sets'
    'print-sets:Prints a list of sets'
    'print-spec:Prints a dependency specification'
    'print-sync-protocols:Prints a list of sync protocols'
    'print-unused-distfiles:Prints all unused distfiles'
    'purge:Uninstall unused packages'
    'report:Display a summary of potential problems with installed packages'
    'resolve:Display how to resolve one or more targets, and possibly then perform that resolution'
    "resume:Resume a failed resolution from \'cave resolve\'"
    'search:Search for packages with particular characteristics'
    'show:Display a summary of a given object'
    'size:Prints the size of files installed by a package'
    'sync:Sync all or specified repositories'
    'sync-protocol-options:Displays options for a given sync protocol'
    'uninstall:Uninstall one or more packages'
    'update-world:Updates the world set'
    "verify:Verify that an installed package\'s files haven\'t changed"
  )

  for (( i=1; i <= ${CURRENT}; i++ )); do
    cmd=${_cave_commands[(r)${words[${i}]}:*]%%:*}
    (( ${#cmd} )) && break
  done

  if (( ${#cmd} )); then
    local curcontext="${curcontext%:*:*}:cave-${cmd}:"

    while [[ ${words[1]} != ${cmd} ]]; do
      (( CURRENT-- ))
      shift words
    done

    _call_function ret _cave_cmd_${cmd}
    return ret
  else
    if [[ ${words[CURRENT-1]} == --* ]]; then
      _arguments -s : \
        ${_cave_arguments}
    else
      _describe -t commands 'cave command' _cave_commands
      _arguments -s : \
        ${_cave_arguments}
    fi
  fi

}

(( ${+functions[_cave_cmd_config]} )) ||
_cave_cmd_config()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_contents]} )) ||
_cave_cmd_contents()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_digest]} )) ||
_cave_digest()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*:package depspec:_cave_packages' \
    '*:repository:_cave_repositories' && return 0
}


(( ${+functions[_cave_cmd_display-resolution]} )) ||
_cave_cmd_display-resolution()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '--show-option-descriptions[Whether to display descriptions for package options]:Which:((none new changed all))' \
    '--show-descriptions[Whether to display package descriptions]:When:((none new all))' \
    '(--explain -X)'{--explain,-X}'[Explain why the resolver made a particular decision]:Spec: ' \
    '--unpackaged-repository-params[Specifies the parameters used to construct an unpackaged repository]'
}

(( ${+functions[_cave_cmd_dump-cave-formats-conf]} )) ||
_cave_cmd_dump-cave-formats-conf()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]'
}

(( ${+functions[_cave_cmd_executables]} )) ||
_cave_cmd_executables()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_execute-resolution]} )) ||
_cave_cmd_execute-resolution()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '--pretend[Only carry out the pretend action]' \
    '--set[Our target is a set rather than package specs]' \
    '--world-specs[Use the specified spec or set name for updating world]' \
    '--removed-if-dependent-names[If nothing is left with the specified name, also remove it from world]' \
    '(--preserve-world -1 --no-preserve-world)'{--preserve-world,-1,--no-preserve-world}'[Do not modify the world set]' \
    '(--continue-on-failure -C)'{--continue-on-failure,-C}'[Whether to continue after an error occurs]:When:((never n if-satisfied s if-independent i always a))' \
    '--resume-file[Write resume information to the specified file]' \
    '(--fetch -f --no-fetch)'{--fetch,-f,--no-fetch}'[Skip any jobs that are not fetch jobs]' \
    '(--fetch-jobs -J)'{--fetch-jobs,-J}'[The number of parallel fetch jobs to launch]' \
    '*--skip-phase[Skip the named phases]:Phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
    '*--abort-at-phase[Abort when a named phase is encountered]:Phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
    '*--skip-until-phase[Skip every phase until a named phase is encountered]:Phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
    '*--change-phases-for[Control to which packages these phase options apply]:Which:((all first last))' \
    '--display-resolution-program[The program used to display the resolution]:Command: ' \
    '--graph-jobs-resolution-program[The program used to graph jobs]:Command: ' \
    '--execute-resolution-program[The program used to execute the resolution]:Command: ' \
    '--perform-program[The program used to perform actions]:Command: ' \
    '--update-world-program[The program used to perform world updates]:Command: ' \
    '--graph-program[The program used to create Graphviz graphs]:Command: ' \
    '--unpackaged-repository-params[Specifies the parameters used to construct an unpackaged repository]'
}

(( ${+functions[_cave_cmd_generate-metadata]} )) ||
_cave_cmd_generate-metadata()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--matching -m)'{--matching,-m}'[Consider only IDs matching this spec]'
}

(( ${+functions[_cave_cmd_find-candidates]} )) ||
_cave_cmd_find-candidates()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all-versions -a --no-all-versions)'{--all-versions,-a,--no-all-versions}'[Search in every version of packages]' \
    '(--visible -v --no-visible)'{--visible,-v,--no-visible}'[Search only in visible (not masked) versions of packages]' \
    '--matching[Search only in packages matching the supplied specification]:Spec: ' \
    '(--type -t)'{--type,-t}'[Specify which matching algorithm to use]:Matching:((text t exact x regex r))' \
    '(--and -& --no-and)'{--and,-\&,--no-and}'[If multiple patterns are specified, require that all patterns match]' \
    '(--not -! --no-not)'{--not,-\!,--no-not}'[Invert the results of pattern matches]' \
    '*'{--key,-k}'[Search the named metadata key]' \
    '(--name -n --no-name)'{--name,-n,--no-name}'[Search package names]' \
    '(--description -d --no-description)'{--description,-d,--no-description}'[Search package descriptions]' \
    '(--enabled-only -e --no-enabled-only)'{--enabled-only,-e,--no-enabled-only}'[Only search enabled parts of conditional dependency spec trees]' \
    '--index[Use the specified index file]:file:_files'
}

(( ${+functions[_cave_cmd_fix-cache]} )) ||
_cave_cmd_fix-cache()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*'{--repository,-r}'[Select the repository with the specified name]:repository name:_cave_repositories' \
    '(--installable -i --no-installable)'{--installable,-i,--no-installable}'[Select all installable repositories]' \
    '(--installed -I --no-installed)'{--installed,-I,--no-installed}'[Select all installed repositories]'
}

(( ${+functions[_cave_cmd_fix-linkage]} )) ||
_cave_cmd_fix-linkage()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--execute -x --no-execute)'{--execute,-x,--no-execute}'[Execute the suggested actions]' \
    '*'{--library,-l}'[Only rebuild packages linked against this library, even if it exists]:Library: ' \
    '(--exact -e --no-exact)'{--exact,-e,--no-exact}'[Rebuild the same package version that is currently installed]'
}

(( ${+functions[_cave_cmd_graph-jobs]} )) ||
_cave_cmd_graph-jobs()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '--graph-jobs-basename[Specify the basename (filename without extension) to be used when creating job graphs]:file:_files' \
    '--graph-jobs-format[Specifies the desired output format for the Graphviz graph]:format: ' \
    '(--graph-jobs-all-arrows --no-graph-jobs-all-arrows)'{--graph-jobs-all-arrows,--no-graph-jobs-all-arrows}'[Show all arrows]' \
    '(--graph-jobs-full-names --no-graph-jobs-full-names)'{--graph-jobs-full-names,--no-graph-jobs-full-names}'[Show full names for graph jobs]' \
    '--unpackaged-repository-params[Specifies the parameters used to construct an unpackaged repository]' \
    '--display-resolution-program[The program used to display the resolution]:Command: ' \
    '--graph-jobs-resolution-program[The program used to graph jobs]:Command: ' \
    '--execute-resolution-program[The program used to execute the resolution]:Command: ' \
    '--perform-program[The program used to perform actions]:Command: ' \
    '--update-world-program[The program used to perform world updates]:Command: ' \
    '--graph-program[The program used to create Graphviz graphs]:Command: '
}

(( ${+functions[_cave_cmd_has-version]} )) ||
_cave_cmd_has-version()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_help]} )) ||
_cave_cmd_help()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all -a)'{--all,-a}'[Print all available commands to standard output]' \
    '*::arg:->cave_commands' && return

  case ${state} in
    (cave_commands)
      _describe -t commands 'cave command' _cave_commands
      ;;
  esac
}

(( ${+functions[_cave_cmd_import]} )) ||
_cave_cmd_import()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--execute -x --no-execute)'{--execute,-x,--no-execute}'[Execute the suggested actions]' \
    '(--location -l)'{--location,-l}'[Specify the directory containing the image to install]' \
    '(--install-under -u)'{--install-under,-u}'[Install under the specified directory, rather than /]' \
    '(--rewrite-ids-over-to-root -r)'{--rewrite-ids-over-to-root,-r}'[Change any UID or GID over this value to 0]' \
    '(--strip -s)'{--strip,-s}'[Specify whether to strip and split objects being installed]:When:((config c always a never n))' \
    '(--preserve-work -p)'{--preserve-work,-p}'[Specify whether to avoid carrying out destructive merge actions]:When:((config c always a never n))' \
    '(--description -D)'{--description,-D}'[Specify a description for the package]:Description: ' \
    '*'{--build-dependency,-B}'[Specify a build dependency]:Package: ' \
    '*'{--run-dependency,-R}'[Specify a run dependency]:Package: ' \
    '(--preserve-metadata -P --no-preserve-metadata)'{--preserve-metadata,-P,--no-preserve-metadata}'[If replacing a package previously installed using this command, copy its description and dependencies]'
}

(( ${+functions[_cave_cmd_info]} )) ||
_cave_cmd_info()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*::arg:->cave_commands' && return
}

(( ${+functions[_cave_cmd_manage-search-index]} )) ||
_cave_cmd_manage-search-index()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--create -c --no-create)'{--create,-c,--no-create}'[Create a new search index. The existing search index is removed if it already exists]:file:_files'
}

(( ${+functions[_cave_cmd_match]} )) ||
_cave_cmd_match()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--type -t)'{--type,-t}'[Specify which matching algorithm to use]:Matching:((text t exact x regex r))' \
    '(--and -& --no-and)'{--and,-\&,--no-and}'[If multiple patterns are specified, require that all patterns match]' \
    '(--not -! --no-not)'{--not,-\!,--no-not}'[Invert the results of pattern matches]' \
    '*'{--key,-k}'[Search the named metadata key]' \
    '(--name -n --no-name)'{--name,-n,--no-name}'[Search package names]' \
    '(--description -d --no-description)'{--description,-d,--no-description}'[Search package descriptions]' \
    '(--enabled-only -e --no-enabled-only)'{--enabled-only,-e,--no-enabled-only}'[Only search enabled parts of conditional dependency spec trees]'
}

(( ${+functions[_cave_cmd_mirror]} )) ||
_cave_cmd_mirror()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--matching -m)'{--matching,-m}'[Consider only IDs matching this spec]'
}

(( ${+functions[_cave_cmd_owner]} )) ||
_cave_cmd_owner()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--match -m)'{--match,-m}'[Which match algorithm to use]:match algorithm:((auto\:"If pattern starts with a \/, full; if it contains a \/, partial; otherwise, basename"
                                                                                   a\:"If pattern starts with a \/, full; if it contains a \/, partial; otherwise, basename"
                                                                            basename\:"Basename match"
                                                                                   b\:"Basename match"
                                                                                full\:"Full match"
                                                                                   f\:"Full match"
                                                                             partial\:"Partial match"
                                                                                   p\:"Partial match"))' \
    '(--dereference -d)'{--dereference,-d}'[If the pattern is a path that exists and is a symbolic link, dereference it recursively, and then search for the real path]' \
    '*:file:_files'
}

(( ${+functions[_cave_cmd_perform]} )) ||
_cave_cmd_perform()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--if-supported --no-if-supported)'{--if-supported,--no-if-supported}'[If the action is not supported, exit silently with success rather than erroring]' \
    '(--hooks --no-hooks)'{--hooks,--no-hooks}'[Also execute the appropriate hooks for the action]' \
    '--x-of-y[Specify the value of the X_OF_Y variable that is passed to hooks]:value: ' \
    '--no-terminal-titles[Do not change terminal titles]' \
    '--managed-output[Specify that our output is being managed by another process]' \
    '--output-exclusivity[Specify the exclusivity of our output]:Exclusitivity:((exclusive with-others background))' \
    ':subcommand:->subcommand' \
    '*::options:->options' && ret=0

    case ${state} in
      (subcommand)
        declare -a subcommand
        subcommand=(
          'config'
          'fetch'
          'info'
          'install'
          'pretend'
          'pretend-fetch'
          'uninstall'
        )

        _describe -t subcommand command subcommand && ret=0
        ;;
      (options)
        declare -a arguments

        case ${line[1]} in
          config|info)
            _arguments -s : \
              '*:package depspec:_cave_packages' && ret=0
            ;;
          fetch|pretend-fetch)
            _arguments -s : \
              '(--exclude-unmirrorable --no-exclude-unmirrorable)'{--exclude-unmirrorable,--no-exclude-unmirrorable}'[Do not include unmirrorable components]' \
              '(--fetch-unneeded --no-fetch-unneeded)'{--fetch-unneeded,--no-fetch-unneeded}'[Also fetch components that aren'\''t needed]' \
              '(--ignore-unfetched --no-ignore-unfetched)'{--ignore-unfetched,--no-ignore-unfetched}'[Do not fetch any component that has not already been downloaded]' \
              '(--ignore-manual-fetch-errors --no-ignore-manual-fetch-errors)'{--ignore-manual-fetch-errors,--no-ignore-manual-fetch-errors}'[Ignore any errors that say that manual fetching is required for a component]' \
              '(--regulars-only --no-regulars-only)'{--regulars-only,--no-regulars-only}'[Only fetch regular components]' \
              '*:package depspec:_cave_packages' && ret=0
            ;;
          install|pretend)
            _arguments -s : \
              '--destination[Repository to which the install should take place]:repository name:_cave_repositories' \
              '*--replacing[Spec uniquely identifying the ID to be replaced as part of the install]:package spec: ' \
              '*--skip-phase[Skip the named phases]:phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
              '*--abort-at-phase[Abort when a named phase is encountered]:phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
              '*--skip-until-phase[Skip every phase until a named phase is encountered]:phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
              '*:package depspec:_cave_packages' && ret=0
            ;;
          uninstall)
            _arguments -s : \
              '*--config-protect[Specify additional items to include in the config protection list]:file:_files' \
              '*:package depspec:_cave_packages' && ret=0
            ;;
        esac
        ;;
    esac
}

(( ${+functions[_cave_cmd_print-best-version]} )) ||
_cave_cmd_print-best-version()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--format -f)'{--format,-f}'[Select the output format]:Format:((full f spec s name n version v name-version V))' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_print-categories]} )) ||
_cave_cmd_print-categories()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*--containing[Show only categories containing this package name]:package name: ' \
    '*--repository[Show only categories in this repository]:repository name:_cave_repositories'
}

(( ${+functions[_cave_cmd_print-commands]} )) ||
_cave_cmd_print-commands()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all -a)'{--all,-a}'[Print all available commands]'
}

(( ${+functions[_cave_cmd_print-dependent-ids]} )) ||
_cave_cmd_print-dependent-ids()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--format -f)'{--format,-f}'[Select the output format]:output format: '
}

(( ${+functions[_cave_cmd_print-environment-metadata]} )) ||
_cave_cmd_print-environment-metadata()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*--raw-name[Show only keys with this raw name]:raw name: ' \
    '*--human-name[Show only keys with this human name]:human name: ' \
    '--format[Select the output format]:format: '
}

(( ${+functions[_cave_cmd_print-id-actions]} )) ||
_cave_cmd_print-id-actions()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all -a --no-all)'{--all,-a,--no-all}'[If the spec matches multiple IDs, display all matches]' \
    '(--best -b --no-best)'{--best,-b,--no-best}'[If the spec matches multiple IDs, select the best ID rather than giving an error]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_print-id-contents]} )) ||
_cave_cmd_print-id-contents()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all -a --no-all)'{--all,-a,--no-all}'[If the spec matches multiple IDs, display all matches]' \
    '(--best -b --no-best)'{--best,-b,--no-best}'[If the spec matches multiple IDs, select the best ID rather than giving an error]' \
    '--format[Select the output format]:format: ' \
    '*'{--type,-t}'[Display only entries of the specified type]:contents type:((all\:"Show all entries"
                                                                                a\:"Show all entries"
                                                                                file\:"Show only file entries"
                                                                                f\:"Show only file entries"
                                                                                dir\:"Show only directory entries"
                                                                                d\:"Show only directory entries"
                                                                                sym\:"Show only symlink entries"
                                                                                s\:"Show only symlink entries"
                                                                                other\:"Show only other entries"
                                                                                o\:"Show only other entries"))' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_print-id-environment-variable]} )) ||
_cave_cmd_print-id-environment-variable()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all -a --no-all)'{--all,-a,--no-all}'[If the spec matches multiple IDs, display all matches]' \
    '(--best -b --no-best)'{--best,-b,--no-best}'[If the spec matches multiple IDs, select the best ID rather than giving an error]' \
    '*--variable-name[Show this environment variable]:environment variable: ' \
    '--format[Select the output format]:format: ' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_print-id-executables]} )) ||
_cave_cmd_print-id-executables()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all -a --no-all)'{--all,-a,--no-all}'[If the spec matches multiple IDs, display all matches]' \
    '(--best -b --no-best)'{--best,-b,--no-best}'[If the spec matches multiple IDs, select the best ID rather than giving an error]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_print-id-masks]} )) ||
_cave_cmd_print-id-masks()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all -a --no-all)'{--all,-a,--no-all}'[If the spec matches multiple IDs, display all matches]' \
    '(--best -b --no-best)'{--best,-b,--no-best}'[If the spec matches multiple IDs, select the best ID rather than giving an error]' \
    '(--overridden --no-overridden)'{--overridden,--no-overridden}'[Show overridden masks]' \
    '(--no-active --no-no-active)'{--no-active,--no-no-active}'[No not show active (non-overridden) masks]' \
    '--format[Select the output format]:format: ' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_print-id-metadata]} )) ||
_cave_cmd_print-id-metadata()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all -a --no-all)'{--all,-a,--no-all}'[If the spec matches multiple IDs, display all matches]' \
    '(--best -b --no-best)'{--best,-b,--no-best}'[If the spec matches multiple IDs, select the best ID rather than giving an error]' \
    '*--raw-name[Show only keys with this raw name]:raw name: ' \
    '*--human-name[Show only keys with this human name]:human name: ' \
    '--format[Select the output format]:output format: ' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_print-id-size]} )) ||
_cave_cmd_print-id-size()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all --no-all -a)'{--all,--no-all,-a}'[If the spec matches multiple IDs, display all matches]' \
    '(--best --no-best -b)'{--best,--no-best,-b}'[If the spec matches multiple IDs, select the best ID rather than giving an error]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_print-ids]} )) ||
_cave_cmd_print-ids()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*'{--matching,-m}'[Show only IDs matching this spec]:package spec: ' \
    '*'{--supporting,-s}'[Show only IDs supporting this action]:supporting action:((install uninstall pretend config fetch pretend-fetch info))' \
    '(--with-mask -M)'{--with-mask,-M}'[Show only IDs with this kind of mask]:with mask:((none any user unaccepted repository unsupported association))' \
    '(--format -f)'{--format,-f}'[Select the output format]:output format: '
}

(( ${+functions[_cave_cmd_print-owners]} )) ||
_cave_cmd_print-owners()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--match -m)'{--match,-m}'[Which match algorithm to use]:match algorithm:((auto\:"If pattern starts with a \/, full; if it contains a \/, partial; otherwise, basename"
                                                                                basename\:"Basename match"
                                                                                full\:"Full match"
                                                                                partial\:"Partial match"))' \
    '*:file:_files'
}

(( ${+functions[_cave_cmd_print-packages]} )) ||
_cave_cmd_print-packages()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*'{--repository,-r}'[Show only names in the specified repository]' \
    '*'{--category,-c}'[Show only names in the specified category]'
}

(( ${+functions[_cave_cmd_print-repositories]} )) ||
_cave_cmd_print-repositories()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '--format[Show only repositories of a specific format]:repository format: '
}

(( ${+functions[_cave_cmd_print-repository-formats]} )) ||
_cave_cmd_print-repository-formats()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]'
}

(( ${+functions[_cave_cmd_print-repository-metadata]} )) ||
_cave_cmd_print-repository-metadata()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*--raw-name[Show only keys with this raw name]:raw name: ' \
    '*--human-name[Show only keys with this human name]:human name: ' \
    '--format[Select the output format]:format: ' \
    '*:repository:_cave_repositories' && return 0
}

(( ${+functions[_cave_cmd_print-set]} )) ||
_cave_cmd_print-set()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--expand -x --no-expand)'{--expand,-x,--no-expand}'[Expand set contents recursively]'
}

(( ${+functions[_cave_cmd_print-sets]} )) ||
_cave_cmd_print-sets()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]'
}

(( ${+functions[_cave_cmd_print-spec]} )) ||
_cave_cmd_print-spec()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '--package[Specify the cat/pkg requirement]:category-package name: ' \
    '--slot[Specify the slot requirement]:slot: ' \
    '--in-repository[Specify the in-repository requirement]:repository:_cave_repositories' \
    '--from-repository[Specify the from-repository requirement]:repository:_cave_repositories' \
    '--installable-to-repository[Specify the installable-to-repository requirement]:repository:_cave_repositories' \
    '--installed-at-path[Specify the installed-at-path requirement]:dir:_files' \
    '--installable-to-path[Specify the installable-to-path requirement]:dir:_files' \
    '--package-part[Specify the /pkg requirement]:package name: ' \
    '--category-part[Specify the cat/ requirement]:category name: ' \
    '*--version-requirement[Specify a version requirement]:version: ' \
    '--version-requirements-mode[Specify the mode of version requirements]:mode:((default and or))' \
    '*--additional-requirement[Specify an additional requirement]:requirement: ' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_print-sync-protocols]} )) ||
_cave_cmd_print-sync-protocols()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]'
}

(( ${+functions[_cave_cmd_print-unused-distfiles]} )) ||
_cave_cmd_print-unused-distfiles()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*'{--include,-i}'[Treat all distfiles from IDs in the specified repository as used]:repository:_cave_repositories'
}

(( ${+functions[_cave_cmd_report]} )) ||
_cave_cmd_report()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]'
}

_cave_resolve_arguments=(
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--execute -x --no-execute)'{--execute,-x,--no-execute}'[Execute the suggested actions]' \
    '(--lazy -z --complete -c --everything -e --no-lazy --no-complete --no-everything)'{--lazy,-z,--no-lazy}'[Do as little work as possible]' \
    '(--lazy -z --complete -c --everything -e --no-lazy --no-complete --no-everything)'{--complete,-c,--no-complete}'[Do all optional work]' \
    '(--lazy -z --complete -c --everything -e --no-lazy --no-complete --no-everything)'{--everything,-e,--no-everything}'[Do all optional work, and also reinstall]' \
    '*'{--permit-uninstall,-U}'[Permit uninstallation of packages matching the supplied specification]:Spec: ' \
    '*'{--permit-downgrade,-d}'[Permit downgrades matching the supplied specification]:Spec: ' \
    '*'{--permit-old-version,-o}'[Permit installs of versions matching the supplied specification even if those versions are worse than the best visible version in the slot]:Spec: ' \
    '*'{--purge,-P}'[Purge packages matching the given specification, if they will no longer be used after a resolution]:Spec: ' \
    '(--no-override-masks --no-no-override-masks)'{--no-override-masks,--no-no-override-masks}'[If otherwise unable to make a decision, unless this option is specified the resolver will try packages that are weakly masked too]' \
    '(--no-override-flags --no-no-override-flags)'{--no-override-flags,--no-no-override-flags}'[If otherwise unable to make a decision, unless this option is specified the resolver will try selecting packages using different options to the ones specified in the user'\''s configuration]' \
    '*--no-restarts-for[Do not restart if the problematic package has the specified package name]:Spec: ' \
    '*'{--uninstalls-may-break,-u}'[Permit uninstalls that might break packages matching the specified specification]:Spec: ' \
    '*'{--remove-if-dependent,-r}'[Remove dependent packages that might be broken by other changes if those packages match the specified specification]:Spec: ' \
    '*'{--less-restrictive-remove-blockers,-l}'[Use less restrictive blockers for packages matching the supplied specification if that package is to be removed by --remove-if-dependent]:Spec: ' \
    '*--reinstall-dependents-of[Force any installed package that is dependent upon any installed package matching the supplied spec to be reinstalled]:Spec: ' \
    '(--keep-targets -K)'{--keep-targets,-K}'[Select whether to keep target packages]:When:((auto a never n if-transient t if-same s if-same-version v if-possible p))' \
    '(--keep -k)'{--keep,-k}'[Select whether to keep installed packages that are not targets]:When:((never n if-transient t if-same s if-same-version v if-possible p))' \
    '(--reinstall-scm -R)'{--reinstall-scm,-R}'[Select whether to reinstall SCM packages that would otherwise be kept]:When:((always a daily d weekly w never n))' \
    '*'{--with,-w}'[Never keep installed packages with the supplied package name]:Spec: ' \
    '*'{--without,-W}'[Keep installed packages with the supplied package name if possible]:Spec: ' \
    '(--target-slots -S)'{--target-slots,-S}'[Which slots to consider for targets]:Which:((best-or-installed x installed-or-best i all a best b))' \
    '(--slots -s)'{--slots,-s}'[Which slots to consider for packages that are not targets]:Which:((best-or-installed x installed-or-best i all a best b))' \
    '(--follow-installed-build-dependencies --no-follow-installed-build-dependencies -B)'{--follow-installed-build-dependencies,--no-follow-installed-build-dependencies,-B}'[Follow build dependencies for installed packages]' \
    '(--no-follow-installed-dependencies --no-no-follow-installed-dependencies -n)'{--no-follow-installed-dependencies,--no-no-follow-installed-dependencies,-n}'[Ignore dependencies for installed packages]' \
    '*'{--no-dependencies-from,-0}'[Ignore dependencies (not blockers) from packages matching the supplied specification]:Spec: ' \
    '*'{--no-blockers-from,-!}'[Ignore blockers from packages matching the supplied specification]:Spec: ' \
    '--suggestions[How to treat suggestions and recommendations]:When:((ignore display take))' \
    '--recommendations[How to treat recommendations]:When:((ignore display take))' \
    '*'{--take,-t}'[Take any suggestion matching the supplied package specification or group name]:Spec: ' \
    '*'{--take-from,-T}'[Take all suggestions made by any package matching the supplied package specification]:Spec: ' \
    '*'{--ignore,-i}'[Discard any suggestion matching the supplied package specification or group name]:Spec: ' \
    '*'{--ignore-from,-I}'[Discard all suggestions made by any package matching the supplied package specification]:Spec: ' \
    '*'{--favour,-F}'[If there is a choice, favour the specified package names]:Spec: ' \
    '*'{--avoid,-A}'[If there is a choice, avoid the specified package names]:Spec: ' \
    '*'{--not-usable,-N}'[Consider installed packages matching the supplied specification as being unusable when breaking dependency cycles]' \
    '*'{--early,-E}'[When given a collection of otherwise equally desirable packages to order, order packages matching the supplied spec first]' \
    '*'{--late,-L}'[When given a collection of otherwise equally desirable packages to order, order packages matching the supplied spec last]' \
    '*'{--preset,-p}'[Preset a given constraint]:Spec: ' \
    '(--make -m)'{--make,-m}'[Specify what to do with targets]:Make:((auto a install i binaries b chroot c))' \
    '(--make-dependencies -M)'{--make-dependencies,-M}'[Specify what to do with dependencies of targets]:When:((auto runtime r all a none n))' \
    '*'{--via-binary,-b}'[When building a package matching the supplied spec, create a binary package and use that for the install]' \
    '(--dependencies-to-slash -/)'{--dependencies-to-slash,-/}'[Specify what to do with dependencies for the / filesystem when not working on /]:When:((all a runtime r build b none n))' \
    '--one-binary-per-slot[When building a binary package, remove other versions in the same repository and slot]' \
    '--ignore-unable-decisions[Ignore any resolvent for which we were unable to make a decision. Specifying this will break your system]' \
    '--ignore-unorderable-jobs[Ignore any job we were unable to order. Specifying this will break your system]' \
    '(--dump --no-dump)'{--dump,--no-dump}'[Dump debug output]' \
    '(--dump-restarts --no-dump-restarts)'{--dump-restarts,--no-dump-restarts}'[Dump restarts]' \
    '(--preserve-world -1 --no-preserve-world)'{--preserve-world,-1,--no-preserve-world}'[Do not modify the world set]' \
    '(--continue-on-failure -C)'{--continue-on-failure,-C}'[Whether to continue after an error occurs]:When:((never n if-satisfied s if-independent i always a))' \
    '--resume-file[Write resume information to the specified file]' \
    '(--fetch -f --no-fetch)'{--fetch,-f,--no-fetch}'[Skip any jobs that are not fetch jobs]' \
    '(--fetch-jobs -J)'{--fetch-jobs,-J}'[The number of parallel fetch jobs to launch]' \
    '*--skip-phase[Skip the named phases]:Phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
    '*--abort-at-phase[Abort when a named phase is encountered]:Phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
    '*--skip-until-phase[Skip every phase until a named phase is encountered]:Phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
    '*--change-phases-for[Control to which packages these phase options apply]:Which:((all first last))' \
    '--show-option-descriptions[Whether to display descriptions for package options]:Which:((none new changed all))' \
    '--show-descriptions[Whether to display package descriptions]:When:((none new all))' \
    '(--explain -X)'{--explain,-X}'[Explain why the resolver made a particular decision]:Spec: ' \
    '--graph-jobs-basename[Specify the basename (filename without extension) to be used when creating job graphs]:file:_files' \
    '--graph-jobs-format[Specifies the desired output format for the Graphviz graph]:format: ' \
    '(--graph-jobs-all-arrows --no-graph-jobs-all-arrows)'{--graph-jobs-all-arrows,--no-graph-jobs-all-arrows}'[Show all arrows]' \
    '(--graph-jobs-full-names --no-graph-jobs-full-names)'{--graph-jobs-full-names,--no-graph-jobs-full-names}'[Show full names for graph jobs]' \
    '--display-resolution-program[The program used to display the resolution]:Command: ' \
    '--graph-jobs-resolution-program[The program used to graph jobs]:Command: ' \
    '--execute-resolution-program[The program used to execute the resolution]:Command: ' \
    '--perform-program[The program used to perform actions]:Command: ' \
    '--update-world-program[The program used to perform world updates]:Command: ' \
    '--graph-program[The program used to create Graphviz graphs]:Command: '
)

(( ${+functions[_cave_cmd_purge]} )) ||
_cave_cmd_purge()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    ${_cave_resolve_arguments[@]}
}

(( ${+functions[_cave_cmd_resolve]} )) ||
_cave_cmd_resolve()
{
  _arguments -s : \
    ${_cave_resolve_arguments[@]} \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_resume]} )) ||
_cave_cmd_resume()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--retry-failed -r --no-retry-failed)'{--retry-failed,-r,--no-retry-failed}'[Retry any job that has already failed]' \
    '(--retry-skipped -R --no-retry-skipped)'{--retry-skipped,-R,--no-retry-skipped}'[Retry any job that has already been skipped]' \
    '(--skip-failed -s --no-skip-failed)'{--skip-failed,-s,--no-skip-failed}'[Skip any job that has already failed]' \
    '(--continue-on-failure -C)'{--continue-on-failure,-C}'[Whether to continue after an error occurs]:When:((never n if-satisfied s if-independent i always a))' \
    '--resume-file[Write resume information to the specified file]' \
    '(--fetch -f --no-fetch)'{--fetch,-f,--no-fetch}'[Skip any jobs that are not fetch jobs]' \
    '(--fetch-jobs -J)'{--fetch-jobs,-J}'[The number of parallel fetch jobs to launch]' \
    '*--skip-phase[Skip the named phases]:Phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
    '*--abort-at-phase[Abort when a named phase is encountered]:Phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
    '*--skip-until-phase[Skip every phase until a named phase is encountered]:Phase:((fetch_extra killold init setup unpack prepare configure compile test test_expensive install strip preinst merge prerm postrm postinst tidyup))' \
    '*--change-phases-for[Control to which packages these phase options apply]:Which:((all first last))' \
    '--display-resolution-program[The program used to display the resolution]:Command: ' \
    '--graph-jobs-resolution-program[The program used to graph jobs]:Command: ' \
    '--execute-resolution-program[The program used to execute the resolution]:Command: ' \
    '--perform-program[The program used to perform actions]:Command: ' \
    '--update-world-program[The program used to perform world updates]:Command: ' \
    '--graph-program[The program used to create Graphviz graphs]:Command: '
}

(( ${+functions[_cave_cmd_search]} )) ||
_cave_cmd_search()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all-versions -a --no-all-versions)'{--all-versions,-a,--no-all-versions}'[Search in every version of packages]' \
    '(--visible -v --no-visible)'{--visible,-v,--no-visible}'[Search only in visible (not masked) versions of packages]' \
    '--matching[Search only in packages matching the supplied specification]:Spec: ' \
    '(--type -t)'{--type,-t}'[Specify which matching algorithm to use]:Matching:((text t exact x regex r))' \
    '(--and -& --no-and)'{--and,-\&,--no-and}'[If multiple patterns are specified, require that all patterns match]' \
    '(--not -! --no-not)'{--not,-\!,--no-not}'[Invert the results of pattern matches]' \
    '*'{--key,-k}'[Search the named metadata key]' \
    '(--name -n --no-name)'{--name,-n,--no-name}'[Search package names]' \
    '(--description -d --no-description)'{--description,-d,--no-description}'[Search package descriptions]' \
    '(--enabled-only -e --no-enabled-only)'{--enabled-only,-e,--no-enabled-only}'[Only search enabled parts of conditional dependency spec trees]' \
    '--index[Use the specified index file]:file:_files'
}

(( ${+functions[_cave_cmd_show]} )) ||
_cave_cmd_show()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--type -t)'{--type,-t}'[Specify the type of the specified objects]:object type:((auto a repository r set s wildcard w package p))' \
    '(--no-keys -n)'{--no-keys,-n}'[Do not show any metadata keys]' \
    '(--complex-keys -c --no-complex-keys)'{--complex-keys,-c,--no-complex-keys}'[Show complex keys]' \
    '(--internal-keys -i --no-internal-keys)'{--internal-keys,-i,--no-internal-keys}'[Show keys marked as internal-only]' \
    '(--significant-keys-only -s --no-significant-keys-only)'{--significant-keys-only,-s,--no-significant-keys-only}'[Show only keys marked as significant]' \
    '*'{--key,-k}'[Show keys with the given name]' \
    '(--description-keys -d)'{--description-keys,-d}'[Show description keys, regardless of other options]' \
    '(--flat -f --no-flat)'{--flat,-f,--no-flat}'[Do not spread key values over multiple lines]' \
    '(--raw-names -r --no-raw-names)'{--raw-names,-r,--no-raw-names}'[Display raw rather than human readable key names]' \
    '(--one-version -1 --no-one-version --all-versions -a --no-all-versions --no-versions -0 --no-no-versions)'{--one-version,-1,--no-one-version}'[Display only a single version of any package, rather than all installed and the best installable package]' \
    '(--one-version -1 --no-one-version --all-versions -a --no-all-versions --no-versions -0 --no-no-versions)'{--all-versions,-a,--no-all-versions}'[Display all installed and the best installable packageversions of packages]' \
    '(--one-version -1 --no-one-version --all-versions -a --no-all-versions --no-versions -0 --no-no-versions)'{--no-versions,-0,--no-no-versions}'[Don'\''t display any version-specific information]' \
    '(--repository-at-a-time -R)'{--repository-at-a-time,-R}'[roup versions by repository, and then show details for each individual repository]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_size]} )) ||
_cave_cmd_size()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_sync]} )) ||
_cave_cmd_sync()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '--sequential[Only perform one sync at a time]' \
    '(--suffix -s)'{--suffix,-s}'[Use the specified suffix for syncing]:Suffix: ' \
    '(--revision -r)'{--revision,-r}'[Sync to the specified revision]:Revision: ' \
    '*:repository:_cave_repositories' && return 0
}

(( ${+functions[_cave_cmd_sync-protocol-options]} )) ||
_cave_cmd_sync-protocol-options()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '*:sync protocol:_cave_protocols' && return 0
}

(( ${+functions[_cave_cmd_uninstall]} )) ||
_cave_cmd_uninstall()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--all-versions -a --no-all-versions)'{--all-versions,-a,--no-all-versions}'[Search in every version of packages]' \
    ${_cave_resolve_arguments[@]} \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_update-world]} )) ||
_cave_cmd_update-world()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]' \
    '(--verbose --no-verbose)'{--verbose,--no-verbose}'[Produce verbose output]' \
    '(--remove --no-remove -r)'{--remove,--no-remove,-r}'[Remove the specified items]' \
    '(--if-nothing-left -l)'{--if-nothing-left,-l}'[Skip any removes where versions remain]' \
    '(--set --no-set -s)'{--set,--no-set,-s}'[Parameters are set names, not package names]' \
    '*:package depspec:_cave_packages' && return 0
}

(( ${+functions[_cave_cmd_verify]} )) ||
_cave_cmd_verify()
{
  _arguments -s : \
    '(--help -h)'{--help,-h}'[Display help messsage]'
}

(( ${+functions[_cave_packages]} )) ||
_cave_packages() {
  :
}

(( ${+functions[_cave_protocols]} )) ||
_cave_protocols() {
  local -a _cave_protocols
  _cave_protocols=( $(cave print-sync-protocols) )
  _describe -t protocol 'protocol' _cave_protocols
}

(( ${+functions[_cave_repositories]} )) ||
_cave_repositories() {
  local -a _cave_repositories
  _cave_repositories=( $(cave print-repositories) )
  _describe -t repository 'repository' _cave_repositories
}

_cave "${@}"