_swift
39695 bytes
1#compdef swift
2local context state state_descr line
3_swift_commandname=$words[1]
4typeset -A opt_args
5
6_swift() {
7 integer ret=1
8 local -a args
9 args+=(
10 '(-h --help)'{-h,--help}'[Show help information.]'
11 '(-): :->command'
12 '(-)*:: :->arg'
13 )
14 _arguments -w -s -S $args[@] && ret=0
15 case $state in
16 (command)
17 local subcommands
18 subcommands=(
19 'run:Build and run an executable product'
20 'build:Build sources into binary products'
21 'test:Build and run tests'
22 'package:Perform operations on Swift packages'
23 'help:Show subcommand help information.'
24 )
25 _describe "subcommand" subcommands
26 ;;
27 (arg)
28 case ${words[1]} in
29 (run)
30 _swift_run
31 ;;
32 (build)
33 _swift_build
34 ;;
35 (test)
36 _swift_test
37 ;;
38 (package)
39 _swift_package
40 ;;
41 (help)
42 _swift_help
43 ;;
44 esac
45 ;;
46 esac
47
48 return ret
49}
50
51_swift_run() {
52 integer ret=1
53 local -a args
54 args+=(
55 '--package-path[Specify the package path to operate on (default current directory). This changes the working directory before any other operation]:package-path:_files -/'
56 '--cache-path[Specify the shared cache directory path]:cache-path:_files -/'
57 '--config-path[Specify the shared configuration directory path]:config-path:_files -/'
58 '--security-path[Specify the shared security directory path]:security-path:_files -/'
59 '--scratch-path[Specify a custom scratch directory path (default .build)]:scratch-path:_files -/'
60 '--pkg-config-path[Specify alternative path to search for pkg-config `.pc` files. Use the option multiple times to
61 specify more than one path.]:pkg-config-path:_files -/'
62 '--enable-dependency-cache[Use a shared cache when fetching dependencies]'
63 '--disable-dependency-cache[Use a shared cache when fetching dependencies]'
64 '--enable-build-manifest-caching'
65 '--disable-build-manifest-caching'
66 '--manifest-cache[Caching mode of Package.swift manifests (shared: shared cache, local: package'"'"'s build directory, none: disabled]:manifest-cache:'
67 '(--verbose -v)'{--verbose,-v}'[Increase verbosity to include informational output]'
68 '(--very-verbose --vv)'{--very-verbose,--vv}'[Increase verbosity to include debug output]'
69 '(--quiet -q)'{--quiet,-q}'[Decrease verbosity to only include error output.]'
70 '--disable-sandbox[Disable using the sandbox when executing subprocesses]'
71 '--netrc[Use netrc file even in cases where other credential stores are preferred]'
72 '--enable-netrc[Load credentials from a netrc file]'
73 '--disable-netrc[Load credentials from a netrc file]'
74 '--netrc-file[Specify the netrc file path]:netrc-file:_files'
75 '--enable-keychain[Search credentials in macOS keychain]'
76 '--disable-keychain[Search credentials in macOS keychain]'
77 '--resolver-fingerprint-checking:resolver-fingerprint-checking:'
78 '--resolver-signing-entity-checking:resolver-signing-entity-checking:'
79 '--enable-signature-validation[Validate signature of a signed package release downloaded from registry]'
80 '--disable-signature-validation[Validate signature of a signed package release downloaded from registry]'
81 '--enable-prefetching'
82 '--disable-prefetching'
83 '(--force-resolved-versions --disable-automatic-resolution --only-use-versions-from-resolved-file)'{--force-resolved-versions,--disable-automatic-resolution,--only-use-versions-from-resolved-file}'[Only use versions from the Package.resolved file and fail resolution if it is out-of-date]'
84 '--skip-update[Skip updating dependencies from their remote during a resolution]'
85 '--disable-scm-to-registry-transformation[disable source control to registry transformation]'
86 '--use-registry-identity-for-scm[look up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins]'
87 '--replace-scm-with-registry[look up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible]'
88 '--default-registry-url[Default registry URL to use, instead of the registries.json configuration file]:default-registry-url:'
89 '(--configuration -c)'{--configuration,-c}'[Build with configuration]:configuration:(debug release)'
90 '-Xcc[Pass flag through to all C compiler invocations]:Xcc:'
91 '-Xswiftc[Pass flag through to all Swift compiler invocations]:Xswiftc:'
92 '-Xlinker[Pass flag through to all linker invocations]:Xlinker:'
93 '-Xcxx[Pass flag through to all C++ compiler invocations]:Xcxx:'
94 '--triple:triple:'
95 '--sdk:sdk:_files -/'
96 '--toolchain:toolchain:_files -/'
97 '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:(address thread undefined scudo)'
98 '--auto-index-store[Enable or disable indexing-while-building feature]'
99 '--enable-index-store[Enable or disable indexing-while-building feature]'
100 '--disable-index-store[Enable or disable indexing-while-building feature]'
101 '--enable-parseable-module-interfaces'
102 '(--jobs -j)'{--jobs,-j}'[The number of jobs to spawn in parallel during the build process]:jobs:'
103 '--emit-swift-module-separately'
104 '--use-integrated-swift-driver'
105 '--explicit-target-dependency-import-check:explicit-target-dependency-import-check:'
106 '--experimental-explicit-module-build'
107 '--build-system:build-system:(native xcode)'
108 '--enable-dead-strip[Disable/enable dead code stripping by the linker]'
109 '--disable-dead-strip[Disable/enable dead code stripping by the linker]'
110 '--static-swift-stdlib[Link Swift stdlib statically]'
111 '--no-static-swift-stdlib[Link Swift stdlib statically]'
112 '--repl[Launch Swift REPL for the package]'
113 '--debugger[Launch the executable in a debugger session]'
114 '--run[Launch the executable with the provided arguments]'
115 '--skip-build[Skip building the executable product]'
116 '--build-tests[Build both source and test targets]'
117 ':executable:{local -a list; list=(${(f)"$(swift package completion-tool list-executables)"}); _describe '''' list}'
118 ':arguments:'
119 '--version[Show the version.]'
120 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
121 )
122 _arguments -w -s -S $args[@] && ret=0
123
124 return ret
125}
126
127_swift_build() {
128 integer ret=1
129 local -a args
130 args+=(
131 '--package-path[Specify the package path to operate on (default current directory). This changes the working directory before any other operation]:package-path:_files -/'
132 '--cache-path[Specify the shared cache directory path]:cache-path:_files -/'
133 '--config-path[Specify the shared configuration directory path]:config-path:_files -/'
134 '--security-path[Specify the shared security directory path]:security-path:_files -/'
135 '--scratch-path[Specify a custom scratch directory path (default .build)]:scratch-path:_files -/'
136 '--pkg-config-path[Specify alternative path to search for pkg-config `.pc` files. Use the option multiple times to
137 specify more than one path.]:pkg-config-path:_files -/'
138 '--enable-dependency-cache[Use a shared cache when fetching dependencies]'
139 '--disable-dependency-cache[Use a shared cache when fetching dependencies]'
140 '--enable-build-manifest-caching'
141 '--disable-build-manifest-caching'
142 '--manifest-cache[Caching mode of Package.swift manifests (shared: shared cache, local: package'"'"'s build directory, none: disabled]:manifest-cache:'
143 '(--verbose -v)'{--verbose,-v}'[Increase verbosity to include informational output]'
144 '(--very-verbose --vv)'{--very-verbose,--vv}'[Increase verbosity to include debug output]'
145 '(--quiet -q)'{--quiet,-q}'[Decrease verbosity to only include error output.]'
146 '--disable-sandbox[Disable using the sandbox when executing subprocesses]'
147 '--netrc[Use netrc file even in cases where other credential stores are preferred]'
148 '--enable-netrc[Load credentials from a netrc file]'
149 '--disable-netrc[Load credentials from a netrc file]'
150 '--netrc-file[Specify the netrc file path]:netrc-file:_files'
151 '--enable-keychain[Search credentials in macOS keychain]'
152 '--disable-keychain[Search credentials in macOS keychain]'
153 '--resolver-fingerprint-checking:resolver-fingerprint-checking:'
154 '--resolver-signing-entity-checking:resolver-signing-entity-checking:'
155 '--enable-signature-validation[Validate signature of a signed package release downloaded from registry]'
156 '--disable-signature-validation[Validate signature of a signed package release downloaded from registry]'
157 '--enable-prefetching'
158 '--disable-prefetching'
159 '(--force-resolved-versions --disable-automatic-resolution --only-use-versions-from-resolved-file)'{--force-resolved-versions,--disable-automatic-resolution,--only-use-versions-from-resolved-file}'[Only use versions from the Package.resolved file and fail resolution if it is out-of-date]'
160 '--skip-update[Skip updating dependencies from their remote during a resolution]'
161 '--disable-scm-to-registry-transformation[disable source control to registry transformation]'
162 '--use-registry-identity-for-scm[look up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins]'
163 '--replace-scm-with-registry[look up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible]'
164 '--default-registry-url[Default registry URL to use, instead of the registries.json configuration file]:default-registry-url:'
165 '(--configuration -c)'{--configuration,-c}'[Build with configuration]:configuration:(debug release)'
166 '-Xcc[Pass flag through to all C compiler invocations]:Xcc:'
167 '-Xswiftc[Pass flag through to all Swift compiler invocations]:Xswiftc:'
168 '-Xlinker[Pass flag through to all linker invocations]:Xlinker:'
169 '-Xcxx[Pass flag through to all C++ compiler invocations]:Xcxx:'
170 '--triple:triple:'
171 '--sdk:sdk:_files -/'
172 '--toolchain:toolchain:_files -/'
173 '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:(address thread undefined scudo)'
174 '--auto-index-store[Enable or disable indexing-while-building feature]'
175 '--enable-index-store[Enable or disable indexing-while-building feature]'
176 '--disable-index-store[Enable or disable indexing-while-building feature]'
177 '--enable-parseable-module-interfaces'
178 '(--jobs -j)'{--jobs,-j}'[The number of jobs to spawn in parallel during the build process]:jobs:'
179 '--emit-swift-module-separately'
180 '--use-integrated-swift-driver'
181 '--explicit-target-dependency-import-check:explicit-target-dependency-import-check:'
182 '--experimental-explicit-module-build'
183 '--build-system:build-system:(native xcode)'
184 '--enable-dead-strip[Disable/enable dead code stripping by the linker]'
185 '--disable-dead-strip[Disable/enable dead code stripping by the linker]'
186 '--static-swift-stdlib[Link Swift stdlib statically]'
187 '--no-static-swift-stdlib[Link Swift stdlib statically]'
188 '--build-tests[Build both source and test targets]'
189 '--show-bin-path[Print the binary output path]'
190 '--print-manifest-job-graph[Write the command graph for the build manifest as a graphviz file]'
191 '--target[Build the specified target]:target:'
192 '--product[Build the specified product]:product:'
193 '--version[Show the version.]'
194 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
195 )
196 _arguments -w -s -S $args[@] && ret=0
197
198 return ret
199}
200
201_swift_test() {
202 integer ret=1
203 local -a args
204 args+=(
205 '--package-path[Specify the package path to operate on (default current directory). This changes the working directory before any other operation]:package-path:_files -/'
206 '--cache-path[Specify the shared cache directory path]:cache-path:_files -/'
207 '--config-path[Specify the shared configuration directory path]:config-path:_files -/'
208 '--security-path[Specify the shared security directory path]:security-path:_files -/'
209 '--scratch-path[Specify a custom scratch directory path (default .build)]:scratch-path:_files -/'
210 '--pkg-config-path[Specify alternative path to search for pkg-config `.pc` files. Use the option multiple times to
211 specify more than one path.]:pkg-config-path:_files -/'
212 '--enable-dependency-cache[Use a shared cache when fetching dependencies]'
213 '--disable-dependency-cache[Use a shared cache when fetching dependencies]'
214 '--enable-build-manifest-caching'
215 '--disable-build-manifest-caching'
216 '--manifest-cache[Caching mode of Package.swift manifests (shared: shared cache, local: package'"'"'s build directory, none: disabled]:manifest-cache:'
217 '(--verbose -v)'{--verbose,-v}'[Increase verbosity to include informational output]'
218 '(--very-verbose --vv)'{--very-verbose,--vv}'[Increase verbosity to include debug output]'
219 '(--quiet -q)'{--quiet,-q}'[Decrease verbosity to only include error output.]'
220 '--disable-sandbox[Disable using the sandbox when executing subprocesses]'
221 '--netrc[Use netrc file even in cases where other credential stores are preferred]'
222 '--enable-netrc[Load credentials from a netrc file]'
223 '--disable-netrc[Load credentials from a netrc file]'
224 '--netrc-file[Specify the netrc file path]:netrc-file:_files'
225 '--enable-keychain[Search credentials in macOS keychain]'
226 '--disable-keychain[Search credentials in macOS keychain]'
227 '--resolver-fingerprint-checking:resolver-fingerprint-checking:'
228 '--resolver-signing-entity-checking:resolver-signing-entity-checking:'
229 '--enable-signature-validation[Validate signature of a signed package release downloaded from registry]'
230 '--disable-signature-validation[Validate signature of a signed package release downloaded from registry]'
231 '--enable-prefetching'
232 '--disable-prefetching'
233 '(--force-resolved-versions --disable-automatic-resolution --only-use-versions-from-resolved-file)'{--force-resolved-versions,--disable-automatic-resolution,--only-use-versions-from-resolved-file}'[Only use versions from the Package.resolved file and fail resolution if it is out-of-date]'
234 '--skip-update[Skip updating dependencies from their remote during a resolution]'
235 '--disable-scm-to-registry-transformation[disable source control to registry transformation]'
236 '--use-registry-identity-for-scm[look up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins]'
237 '--replace-scm-with-registry[look up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible]'
238 '--default-registry-url[Default registry URL to use, instead of the registries.json configuration file]:default-registry-url:'
239 '(--configuration -c)'{--configuration,-c}'[Build with configuration]:configuration:(debug release)'
240 '-Xcc[Pass flag through to all C compiler invocations]:Xcc:'
241 '-Xswiftc[Pass flag through to all Swift compiler invocations]:Xswiftc:'
242 '-Xlinker[Pass flag through to all linker invocations]:Xlinker:'
243 '-Xcxx[Pass flag through to all C++ compiler invocations]:Xcxx:'
244 '--triple:triple:'
245 '--sdk:sdk:_files -/'
246 '--toolchain:toolchain:_files -/'
247 '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:(address thread undefined scudo)'
248 '--auto-index-store[Enable or disable indexing-while-building feature]'
249 '--enable-index-store[Enable or disable indexing-while-building feature]'
250 '--disable-index-store[Enable or disable indexing-while-building feature]'
251 '--enable-parseable-module-interfaces'
252 '(--jobs -j)'{--jobs,-j}'[The number of jobs to spawn in parallel during the build process]:jobs:'
253 '--emit-swift-module-separately'
254 '--use-integrated-swift-driver'
255 '--explicit-target-dependency-import-check:explicit-target-dependency-import-check:'
256 '--experimental-explicit-module-build'
257 '--build-system:build-system:(native xcode)'
258 '--enable-dead-strip[Disable/enable dead code stripping by the linker]'
259 '--disable-dead-strip[Disable/enable dead code stripping by the linker]'
260 '--static-swift-stdlib[Link Swift stdlib statically]'
261 '--no-static-swift-stdlib[Link Swift stdlib statically]'
262 '--skip-build[Skip building the test target]'
263 '--test-product[Test the specified product.]:test-product:'
264 '--parallel[Run the tests in parallel.]'
265 '--num-workers[Number of tests to execute in parallel.]:num-workers:'
266 '(--list-tests -l)'{--list-tests,-l}'[Lists test methods in specifier format]'
267 '(--show-codecov-path --show-code-coverage-path --show-coverage-path)'{--show-codecov-path,--show-code-coverage-path,--show-coverage-path}'[Print the path of the exported code coverage JSON file]'
268 '(-s --specifier)'{-s,--specifier}':specifier:'
269 '--filter[Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>]:filter:'
270 '--skip[Skip test cases matching regular expression, Example: --skip PerformanceTests]:skip:'
271 '--xunit-output[Path where the xUnit xml file should be generated.]:xunit-output:_files -/'
272 '--enable-testable-imports[Enable or disable testable imports. Enabled by default.]'
273 '--disable-testable-imports[Enable or disable testable imports. Enabled by default.]'
274 '--enable-code-coverage[Enable code coverage]'
275 '--disable-code-coverage[Enable code coverage]'
276 '--version[Show the version.]'
277 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
278 '(-): :->command'
279 '(-)*:: :->arg'
280 )
281 _arguments -w -s -S $args[@] && ret=0
282 case $state in
283 (command)
284 local subcommands
285 subcommands=(
286 'list:Lists test methods in specifier format'
287 'generate-linuxmain:Generate LinuxMain.swift (deprecated)'
288 )
289 _describe "subcommand" subcommands
290 ;;
291 (arg)
292 case ${words[1]} in
293 (list)
294 _swift_test_list
295 ;;
296 (generate-linuxmain)
297 _swift_test_generate-linuxmain
298 ;;
299 esac
300 ;;
301 esac
302
303 return ret
304}
305
306_swift_test_list() {
307 integer ret=1
308 local -a args
309 args+=(
310 '--skip-build[Skip building the test target]'
311 '--test-product[Test the specified product.]:test-product:'
312 '--version[Show the version.]'
313 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
314 )
315 _arguments -w -s -S $args[@] && ret=0
316
317 return ret
318}
319
320_swift_test_generate-linuxmain() {
321 integer ret=1
322 local -a args
323 args+=(
324 '--version[Show the version.]'
325 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
326 )
327 _arguments -w -s -S $args[@] && ret=0
328
329 return ret
330}
331
332_swift_package() {
333 integer ret=1
334 local -a args
335 args+=(
336 '--package-path[Specify the package path to operate on (default current directory). This changes the working directory before any other operation]:package-path:_files -/'
337 '--cache-path[Specify the shared cache directory path]:cache-path:_files -/'
338 '--config-path[Specify the shared configuration directory path]:config-path:_files -/'
339 '--security-path[Specify the shared security directory path]:security-path:_files -/'
340 '--scratch-path[Specify a custom scratch directory path (default .build)]:scratch-path:_files -/'
341 '--pkg-config-path[Specify alternative path to search for pkg-config `.pc` files. Use the option multiple times to
342 specify more than one path.]:pkg-config-path:_files -/'
343 '--enable-dependency-cache[Use a shared cache when fetching dependencies]'
344 '--disable-dependency-cache[Use a shared cache when fetching dependencies]'
345 '--enable-build-manifest-caching'
346 '--disable-build-manifest-caching'
347 '--manifest-cache[Caching mode of Package.swift manifests (shared: shared cache, local: package'"'"'s build directory, none: disabled]:manifest-cache:'
348 '(--verbose -v)'{--verbose,-v}'[Increase verbosity to include informational output]'
349 '(--very-verbose --vv)'{--very-verbose,--vv}'[Increase verbosity to include debug output]'
350 '(--quiet -q)'{--quiet,-q}'[Decrease verbosity to only include error output.]'
351 '--disable-sandbox[Disable using the sandbox when executing subprocesses]'
352 '--netrc[Use netrc file even in cases where other credential stores are preferred]'
353 '--enable-netrc[Load credentials from a netrc file]'
354 '--disable-netrc[Load credentials from a netrc file]'
355 '--netrc-file[Specify the netrc file path]:netrc-file:_files'
356 '--enable-keychain[Search credentials in macOS keychain]'
357 '--disable-keychain[Search credentials in macOS keychain]'
358 '--resolver-fingerprint-checking:resolver-fingerprint-checking:'
359 '--resolver-signing-entity-checking:resolver-signing-entity-checking:'
360 '--enable-signature-validation[Validate signature of a signed package release downloaded from registry]'
361 '--disable-signature-validation[Validate signature of a signed package release downloaded from registry]'
362 '--enable-prefetching'
363 '--disable-prefetching'
364 '(--force-resolved-versions --disable-automatic-resolution --only-use-versions-from-resolved-file)'{--force-resolved-versions,--disable-automatic-resolution,--only-use-versions-from-resolved-file}'[Only use versions from the Package.resolved file and fail resolution if it is out-of-date]'
365 '--skip-update[Skip updating dependencies from their remote during a resolution]'
366 '--disable-scm-to-registry-transformation[disable source control to registry transformation]'
367 '--use-registry-identity-for-scm[look up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins]'
368 '--replace-scm-with-registry[look up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible]'
369 '--default-registry-url[Default registry URL to use, instead of the registries.json configuration file]:default-registry-url:'
370 '(--configuration -c)'{--configuration,-c}'[Build with configuration]:configuration:(debug release)'
371 '-Xcc[Pass flag through to all C compiler invocations]:Xcc:'
372 '-Xswiftc[Pass flag through to all Swift compiler invocations]:Xswiftc:'
373 '-Xlinker[Pass flag through to all linker invocations]:Xlinker:'
374 '-Xcxx[Pass flag through to all C++ compiler invocations]:Xcxx:'
375 '--triple:triple:'
376 '--sdk:sdk:_files -/'
377 '--toolchain:toolchain:_files -/'
378 '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:(address thread undefined scudo)'
379 '--auto-index-store[Enable or disable indexing-while-building feature]'
380 '--enable-index-store[Enable or disable indexing-while-building feature]'
381 '--disable-index-store[Enable or disable indexing-while-building feature]'
382 '--enable-parseable-module-interfaces'
383 '(--jobs -j)'{--jobs,-j}'[The number of jobs to spawn in parallel during the build process]:jobs:'
384 '--emit-swift-module-separately'
385 '--use-integrated-swift-driver'
386 '--explicit-target-dependency-import-check:explicit-target-dependency-import-check:'
387 '--experimental-explicit-module-build'
388 '--build-system:build-system:(native xcode)'
389 '--enable-dead-strip[Disable/enable dead code stripping by the linker]'
390 '--disable-dead-strip[Disable/enable dead code stripping by the linker]'
391 '--static-swift-stdlib[Link Swift stdlib statically]'
392 '--no-static-swift-stdlib[Link Swift stdlib statically]'
393 '--version[Show the version.]'
394 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
395 '(-): :->command'
396 '(-)*:: :->arg'
397 )
398 _arguments -w -s -S $args[@] && ret=0
399 case $state in
400 (command)
401 local subcommands
402 subcommands=(
403 'clean:Delete build artifacts'
404 'purge-cache:Purge the global repository cache.'
405 'reset:Reset the complete cache/build directory'
406 'update:Update package dependencies'
407 'describe:Describe the current package'
408 'init:Initialize a new package'
409 'diagnose-api-breaking-changes:Diagnose API-breaking changes to Swift modules in a package'
410 'dump-symbol-graph:Dump Symbol Graph'
411 'dump-package:Print parsed Package.swift as JSON'
412 'edit:Put a package in editable mode'
413 'unedit:Remove a package from editable mode'
414 'config:Manipulate configuration of the package'
415 'resolve:Resolve package dependencies'
416 'show-dependencies:Print the resolved dependency graph'
417 'tools-version:Manipulate tools version of the current package'
418 'compute-checksum:Compute the checksum for a binary artifact.'
419 'archive-source:Create a source archive for the package'
420 'completion-tool:Completion tool (for shell completions)'
421 'plugin:Invoke a command plugin or perform other actions on command plugins'
422 )
423 _describe "subcommand" subcommands
424 ;;
425 (arg)
426 case ${words[1]} in
427 (clean)
428 _swift_package_clean
429 ;;
430 (purge-cache)
431 _swift_package_purge-cache
432 ;;
433 (reset)
434 _swift_package_reset
435 ;;
436 (update)
437 _swift_package_update
438 ;;
439 (describe)
440 _swift_package_describe
441 ;;
442 (init)
443 _swift_package_init
444 ;;
445 (diagnose-api-breaking-changes)
446 _swift_package_diagnose-api-breaking-changes
447 ;;
448 (dump-symbol-graph)
449 _swift_package_dump-symbol-graph
450 ;;
451 (dump-package)
452 _swift_package_dump-package
453 ;;
454 (edit)
455 _swift_package_edit
456 ;;
457 (unedit)
458 _swift_package_unedit
459 ;;
460 (config)
461 _swift_package_config
462 ;;
463 (resolve)
464 _swift_package_resolve
465 ;;
466 (show-dependencies)
467 _swift_package_show-dependencies
468 ;;
469 (tools-version)
470 _swift_package_tools-version
471 ;;
472 (compute-checksum)
473 _swift_package_compute-checksum
474 ;;
475 (archive-source)
476 _swift_package_archive-source
477 ;;
478 (completion-tool)
479 _swift_package_completion-tool
480 ;;
481 (plugin)
482 _swift_package_plugin
483 ;;
484 esac
485 ;;
486 esac
487
488 return ret
489}
490
491_swift_package_clean() {
492 integer ret=1
493 local -a args
494 args+=(
495 '--version[Show the version.]'
496 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
497 )
498 _arguments -w -s -S $args[@] && ret=0
499
500 return ret
501}
502
503_swift_package_purge-cache() {
504 integer ret=1
505 local -a args
506 args+=(
507 '--version[Show the version.]'
508 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
509 )
510 _arguments -w -s -S $args[@] && ret=0
511
512 return ret
513}
514
515_swift_package_reset() {
516 integer ret=1
517 local -a args
518 args+=(
519 '--version[Show the version.]'
520 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
521 )
522 _arguments -w -s -S $args[@] && ret=0
523
524 return ret
525}
526
527_swift_package_update() {
528 integer ret=1
529 local -a args
530 args+=(
531 '(--dry-run -n)'{--dry-run,-n}'[Display the list of dependencies that can be updated]'
532 ':packages:'
533 '--version[Show the version.]'
534 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
535 )
536 _arguments -w -s -S $args[@] && ret=0
537
538 return ret
539}
540
541_swift_package_describe() {
542 integer ret=1
543 local -a args
544 args+=(
545 '--type[json | text]:type:'
546 '--version[Show the version.]'
547 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
548 )
549 _arguments -w -s -S $args[@] && ret=0
550
551 return ret
552}
553
554_swift_package_init() {
555 integer ret=1
556 local -a args
557 args+=(
558 '--type[Package type:]:type:'
559 '--name[Provide custom package name]:name:'
560 '--version[Show the version.]'
561 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
562 )
563 _arguments -w -s -S $args[@] && ret=0
564
565 return ret
566}
567
568_swift_package_diagnose-api-breaking-changes() {
569 integer ret=1
570 local -a args
571 args+=(
572 '--breakage-allowlist-path[The path to a text file containing breaking changes which should be ignored by the API comparison. Each ignored breaking change in the file should appear on its own line and contain the exact message to be ignored (e.g. '"'"'API breakage: func foo() has been removed'"'"').]:breakage-allowlist-path:_files -/'
573 ':treeish:'
574 '--products[One or more products to include in the API comparison. If present, only the specified products (and any targets specified using `--targets`) will be compared.]:products:'
575 '--targets[One or more targets to include in the API comparison. If present, only the specified targets (and any products specified using `--products`) will be compared.]:targets:'
576 '--baseline-dir[The path to a directory used to store API baseline files. If unspecified, a temporary directory will be used.]:baseline-dir:_files -/'
577 '--regenerate-baseline[Regenerate the API baseline, even if an existing one is available.]'
578 '--version[Show the version.]'
579 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
580 )
581 _arguments -w -s -S $args[@] && ret=0
582
583 return ret
584}
585
586_swift_package_dump-symbol-graph() {
587 integer ret=1
588 local -a args
589 args+=(
590 '--pretty-print[Pretty-print the output JSON.]'
591 '--skip-synthesized-members[Skip members inherited through classes or default implementations.]'
592 '--minimum-access-level[Include symbols with this access level or more. Possible values: private | fileprivate | internal | public | open]:minimum-access-level:(private fileprivate internal public open)'
593 '--skip-inherited-docs[Skip emitting doc comments for members inherited through classes or default implementations.]'
594 '--include-spi-symbols[Add symbols with SPI information to the symbol graph.]'
595 '--emit-extension-block-symbols[Emit extension block symbols for extensions to external types or directly associate members and conformances with the extended nominal.]'
596 '--omit-extension-block-symbols[Emit extension block symbols for extensions to external types or directly associate members and conformances with the extended nominal.]'
597 '--version[Show the version.]'
598 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
599 )
600 _arguments -w -s -S $args[@] && ret=0
601
602 return ret
603}
604
605_swift_package_dump-package() {
606 integer ret=1
607 local -a args
608 args+=(
609 '--version[Show the version.]'
610 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
611 )
612 _arguments -w -s -S $args[@] && ret=0
613
614 return ret
615}
616
617_swift_package_edit() {
618 integer ret=1
619 local -a args
620 args+=(
621 '--revision[The revision to edit]:revision:'
622 '--branch[The branch to create]:branch:'
623 '--path[Create or use the checkout at this path]:path:_files -/'
624 ':package-name:'
625 '--version[Show the version.]'
626 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
627 )
628 _arguments -w -s -S $args[@] && ret=0
629
630 return ret
631}
632
633_swift_package_unedit() {
634 integer ret=1
635 local -a args
636 args+=(
637 '--force[Unedit the package even if it has uncommitted and unpushed changes]'
638 ':package-name:'
639 '--version[Show the version.]'
640 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
641 )
642 _arguments -w -s -S $args[@] && ret=0
643
644 return ret
645}
646
647_swift_package_config() {
648 integer ret=1
649 local -a args
650 args+=(
651 '--version[Show the version.]'
652 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
653 '(-): :->command'
654 '(-)*:: :->arg'
655 )
656 _arguments -w -s -S $args[@] && ret=0
657 case $state in
658 (command)
659 local subcommands
660 subcommands=(
661 'set-mirror:Set a mirror for a dependency'
662 'unset-mirror:Remove an existing mirror'
663 'get-mirror:Print mirror configuration for the given package dependency'
664 )
665 _describe "subcommand" subcommands
666 ;;
667 (arg)
668 case ${words[1]} in
669 (set-mirror)
670 _swift_package_config_set-mirror
671 ;;
672 (unset-mirror)
673 _swift_package_config_unset-mirror
674 ;;
675 (get-mirror)
676 _swift_package_config_get-mirror
677 ;;
678 esac
679 ;;
680 esac
681
682 return ret
683}
684
685_swift_package_config_set-mirror() {
686 integer ret=1
687 local -a args
688 args+=(
689 '--original[The original url or identity]:original:'
690 '--mirror[The mirror url or identity]:mirror:'
691 '--version[Show the version.]'
692 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
693 )
694 _arguments -w -s -S $args[@] && ret=0
695
696 return ret
697}
698
699_swift_package_config_unset-mirror() {
700 integer ret=1
701 local -a args
702 args+=(
703 '--original[The original url or identity]:original:'
704 '--mirror[The mirror url or identity]:mirror:'
705 '--version[Show the version.]'
706 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
707 )
708 _arguments -w -s -S $args[@] && ret=0
709
710 return ret
711}
712
713_swift_package_config_get-mirror() {
714 integer ret=1
715 local -a args
716 args+=(
717 '--original[The original url or identity]:original:'
718 '--version[Show the version.]'
719 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
720 )
721 _arguments -w -s -S $args[@] && ret=0
722
723 return ret
724}
725
726_swift_package_resolve() {
727 integer ret=1
728 local -a args
729 args+=(
730 '--version[The version to resolve at]:version:'
731 '--branch[The branch to resolve at]:branch:'
732 '--revision[The revision to resolve at]:revision:'
733 ':package-name:'
734 '--version[Show the version.]'
735 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
736 )
737 _arguments -w -s -S $args[@] && ret=0
738
739 return ret
740}
741
742_swift_package_show-dependencies() {
743 integer ret=1
744 local -a args
745 args+=(
746 '--format[text | dot | json | flatlist]:format:'
747 '(--output-path -o)'{--output-path,-o}'[The absolute or relative path to output the resolved dependency graph.]:output-path:_files -/'
748 '--version[Show the version.]'
749 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
750 )
751 _arguments -w -s -S $args[@] && ret=0
752
753 return ret
754}
755
756_swift_package_tools-version() {
757 integer ret=1
758 local -a args
759 args+=(
760 '--set-current[Set tools version of package to the current tools version in use]'
761 '--set[Set tools version of package to the given value]:set:'
762 '--version[Show the version.]'
763 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
764 )
765 _arguments -w -s -S $args[@] && ret=0
766
767 return ret
768}
769
770_swift_package_compute-checksum() {
771 integer ret=1
772 local -a args
773 args+=(
774 ':path:_files -/'
775 '--version[Show the version.]'
776 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
777 )
778 _arguments -w -s -S $args[@] && ret=0
779
780 return ret
781}
782
783_swift_package_archive-source() {
784 integer ret=1
785 local -a args
786 args+=(
787 '(-o --output)'{-o,--output}'[The absolute or relative path for the generated source archive]:output:_files -/'
788 '--version[Show the version.]'
789 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
790 )
791 _arguments -w -s -S $args[@] && ret=0
792
793 return ret
794}
795
796_swift_package_completion-tool() {
797 integer ret=1
798 local -a args
799 args+=(
800 ':mode:(generate-bash-script generate-zsh-script generate-fish-script list-dependencies list-executables list-snippets)'
801 '--version[Show the version.]'
802 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
803 )
804 _arguments -w -s -S $args[@] && ret=0
805
806 return ret
807}
808
809_swift_package_plugin() {
810 integer ret=1
811 local -a args
812 args+=(
813 '--list[List the available command plugins]'
814 '--allow-writing-to-package-directory[Allow the plugin to write to the package directory]'
815 '--allow-writing-to-directory[Allow the plugin to write to an additional directory]:allow-writing-to-directory:'
816 '--allow-network-connections:allow-network-connections:(none local all docker unixDomainSocket)'
817 ':command:'
818 ':arguments:'
819 '--version[Show the version.]'
820 '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
821 )
822 _arguments -w -s -S $args[@] && ret=0
823
824 return ret
825}
826
827_swift_help() {
828 integer ret=1
829 local -a args
830 args+=(
831 ':subcommands:'
832 )
833 _arguments -w -s -S $args[@] && ret=0
834
835 return ret
836}
837
838
839_custom_completion() {
840 local completions=("${(@f)$($*)}")
841 _describe '' completions
842}
843
844_swift