651856d4a3b37467cd26a5c5d8de52bd76a9be7f

Author
Roman Dzieciol <roman.dzieciol@gmail.com>
Committer
Roman Dzieciol <roman.dzieciol@gmail.com>
Date

Message

Update the swiftpm plugin autocompletion for Swift 5.0

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md
  2index 07ca25651150a40aa84ad07e1f9b1fd3aae43b92..d9462fb7f33e6ac3db26b6510733b823259f0fa9 100644
  3--- a/plugins/swiftpm/README.md
  4+++ b/plugins/swiftpm/README.md
  5@@ -20,3 +20,22 @@ plugins=(... swiftpm)
  6 | `spx` | Generates an Xcode project          | `swift package generate-xcodeproj` |
  7 | `sps` | Print the resolved dependency graph | `swift package show-dependencies`  |
  8 | `spd` | Print parsed Package.swift as JSON  | `swift package dump-package`       |
  9+
 10+## Autocompletion
 11+
 12+The `_swift` file enables autocompletion for Swift Package Manager. Current version supports Swift 5.0
 13+
 14+
 15+### Updating the autocompletion for new version of Swift
 16+
 17+To update autocompletion to the Swift version present on your system:
 18+```
 19+swift package completion-tool generate-zsh-script > ~/.oh-my-zsh/plugins/swiftpm/_swift
 20+```
 21+
 22+### Known issues
 23+
 24+If `swiftpm` is not added to your zsh plugins list, autocompletion will still be triggered but will result in errors:
 25+```
 26+_values:compvalues:10: not enough arguments
 27+```
 28diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift
 29index bed6e13a76f8c05c02e4ba5a2eaf4900032382a1..1366b4d9ce7e0f48ab9fe434f9da6d8380a44d00 100644
 30--- a/plugins/swiftpm/_swift
 31+++ b/plugins/swiftpm/_swift
 32@@ -72,16 +72,23 @@ _swift_build() {
 33         "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
 34         "(--chdir -C)"{--chdir,-C}"[]: :_files"
 35         "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
 36-        "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
 37+        "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
 38         "--disable-prefetching[]"
 39         "--skip-update[Skip updating dependencies from their remote during a resolution]"
 40         "--disable-sandbox[Disable using the sandbox when executing subprocesses]"
 41+        "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
 42         "--version[]"
 43         "--destination[]: :_files"
 44         "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
 45         "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
 46         "--static-swift-stdlib[Link Swift stdlib statically]"
 47-        "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
 48+        "--enable-llbuild-library[Enable building with the llbuild library]"
 49+        "--force-resolved-versions[]"
 50+        "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
 51+        "--enable-index-store[Enable indexing-while-building feature]"
 52+        "--disable-index-store[Disable indexing-while-building feature]"
 53+        "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
 54+        "--enable-parseable-module-interfaces[]"
 55         "--build-tests[Build both source and test targets]"
 56         "--product[Build the specified product]:Build the specified product: "
 57         "--target[Build the specified target]:Build the specified target: "
 58@@ -108,17 +115,26 @@ _swift_run() {
 59         "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
 60         "(--chdir -C)"{--chdir,-C}"[]: :_files"
 61         "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
 62-        "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
 63+        "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
 64         "--disable-prefetching[]"
 65         "--skip-update[Skip updating dependencies from their remote during a resolution]"
 66         "--disable-sandbox[Disable using the sandbox when executing subprocesses]"
 67+        "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
 68         "--version[]"
 69         "--destination[]: :_files"
 70         "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
 71         "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
 72         "--static-swift-stdlib[Link Swift stdlib statically]"
 73-        "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
 74+        "--enable-llbuild-library[Enable building with the llbuild library]"
 75+        "--force-resolved-versions[]"
 76+        "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
 77+        "--enable-index-store[Enable indexing-while-building feature]"
 78+        "--disable-index-store[Disable indexing-while-building feature]"
 79+        "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
 80+        "--enable-parseable-module-interfaces[]"
 81         "--skip-build[Skip building the executable product]"
 82+        "--build-tests[Build both source and test targets]"
 83+        "--repl[Launch Swift REPL for the package]"
 84     )
 85     _arguments $arguments && return
 86 }
 87@@ -140,16 +156,23 @@ _swift_package() {
 88         "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
 89         "(--chdir -C)"{--chdir,-C}"[]: :_files"
 90         "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
 91-        "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
 92+        "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
 93         "--disable-prefetching[]"
 94         "--skip-update[Skip updating dependencies from their remote during a resolution]"
 95         "--disable-sandbox[Disable using the sandbox when executing subprocesses]"
 96+        "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
 97         "--version[]"
 98         "--destination[]: :_files"
 99         "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
100         "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
101         "--static-swift-stdlib[Link Swift stdlib statically]"
102-        "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
103+        "--enable-llbuild-library[Enable building with the llbuild library]"
104+        "--force-resolved-versions[]"
105+        "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
106+        "--enable-index-store[Enable indexing-while-building feature]"
107+        "--disable-index-store[Disable indexing-while-building feature]"
108+        "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
109+        "--enable-parseable-module-interfaces[]"
110         '(-): :->command'
111         '(-)*:: :->arg'
112     )
113@@ -158,91 +181,124 @@ _swift_package() {
114         (command)
115             local modes
116             modes=(
117-                'edit:Put a package in editable mode'
118-                'clean:Delete build artifacts'
119-                'init:Initialize a new package'
120-                'dump-package:Print parsed Package.swift as JSON'
121+                'update:Update package dependencies'
122                 'describe:Describe the current package'
123+                'resolve:Resolve package dependencies'
124+                'tools-version:Manipulate tools version of the current package'
125                 'unedit:Remove a package from editable mode'
126-                'update:Update package dependencies'
127+                'show-dependencies:Print the resolved dependency graph'
128+                'fetch:'
129+                'dump-package:Print parsed Package.swift as JSON'
130+                'edit:Put a package in editable mode'
131+                'config:Manipulate configuration of the package'