02972f801b4865c68a1045ce2455b3ac4a9d59ad

Author
Marco Eidinger <eidingermarco@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(swiftpm): update completion for Swift 5.7 (#11299)

* feat(swiftpm): update completion for Swift 5.7

* chore(docs): fix typo

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md
  2index a722c03e4ff7a6cfa4c363a1a823c7b4e4f73166..223a607c19adcb6439f6d8f466232f01efa182a9 100644
  3--- a/plugins/swiftpm/README.md
  4+++ b/plugins/swiftpm/README.md
  5@@ -2,7 +2,7 @@
  6 
  7 ## Description
  8 
  9-This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.1.
 10+This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.7.
 11 
 12 To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`:
 13 
 14diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift
 15index 3a923226d47377591a0fb9670103d13629e4b271..51c9fffa0daf31c7265fd868009409dc5372580e 100644
 16--- a/plugins/swiftpm/_swift
 17+++ b/plugins/swiftpm/_swift
 18@@ -1,474 +1,876 @@
 19 #compdef swift
 20 local context state state_descr line
 21+_swift_commandname=$words[1]
 22 typeset -A opt_args
 23 
 24 _swift() {
 25-    _arguments -C \
 26-        '(- :)--help[prints the synopsis and a list of the most commonly used commands]: :->arg' \
 27-        '(-): :->command' \
 28-        '(-)*:: :->arg' && return
 29-
 30+    integer ret=1
 31+    local -a args
 32+    args+=(
 33+        '(-h --help)'{-h,--help}'[Show help information.]'
 34+        '(-): :->command'
 35+        '(-)*:: :->arg'
 36+    )
 37+    _arguments -w -s -S $args[@] && ret=0
 38     case $state in
 39         (command)
 40-            local tools
 41-            tools=(
 42-                'build:build sources into binary products'
 43-                'run:build and run an executable product'
 44-                'package:perform operations on Swift packages'
 45-                'test:build and run tests'
 46+            local subcommands
 47+            subcommands=(
 48+                'run:Build and run an executable product'
 49+                'build:Build sources into binary products'
 50+                'test:Build and run tests'
 51+                'package:Perform operations on Swift packages'
 52+                'help:Show subcommand help information.'
 53             )
 54-            _alternative \
 55-                'tools:common:{_describe "tool" tools }' \
 56-                'compiler: :_swift_compiler' && _ret=0
 57+            _describe "subcommand" subcommands
 58             ;;
 59         (arg)
 60             case ${words[1]} in
 61-                (build)
 62-                    _swift_build
 63-                    ;;
 64                 (run)
 65                     _swift_run
 66                     ;;
 67-                (package)
 68-                    _swift_package
 69+                (build)
 70+                    _swift_build
 71                     ;;
 72                 (test)
 73                     _swift_test
 74                     ;;
 75-                (*)
 76-                    _swift_compiler
 77+                (package)
 78+                    _swift_package
 79+                    ;;
 80+                (help)
 81+                    _swift_help
 82                     ;;
 83             esac
 84             ;;
 85     esac
 86-}
 87 
 88-_swift_dependency() {
 89-    local dependencies
 90-    dependencies=( $(swift package completion-tool list-dependencies) )
 91-    _describe '' dependencies
 92+    return ret
 93 }
 94 
 95-_swift_executable() {
 96-    local executables
 97-    executables=( $(swift package completion-tool list-executables) )
 98-    _describe '' executables
 99+_swift_run() {
100+    integer ret=1
101+    local -a args
102+    args+=(
103+        '--package-path[Specify the package path to operate on (default current directory). This changes the working directory before any other operation]:package-path:_files -/'
104+        '--cache-path[Specify the shared cache directory path]:cache-path:_files -/'
105+        '--config-path[Specify the shared configuration directory path]:config-path:_files -/'
106+        '--security-path[Specify the shared security directory path]:security-path:_files -/'
107+        '--scratch-path[Specify a custom scratch directory path (default .build)]:scratch-path:_files -/'
108+        '--enable-dependency-cache[Use a shared cache when fetching dependencies]'
109+        '--disable-dependency-cache[Use a shared cache when fetching dependencies]'
110+        '--enable-build-manifest-caching'
111+        '--disable-build-manifest-caching'
112+        '--manifest-cache[Caching mode of Package.swift manifests (shared: shared cache, local: package'"'"'s build directory, none: disabled]:manifest-cache:'
113+        '(--verbose -v)'{--verbose,-v}'[Increase verbosity to include informational output]'
114+        '(--very-verbose --vv)'{--very-verbose,--vv}'[Increase verbosity to include debug output]'
115+        '--disable-sandbox[Disable using the sandbox when executing subprocesses]'
116+        '--enable-netrc[Load credentials from a .netrc file]'
117+        '--disable-netrc[Load credentials from a .netrc file]'