swiftpm: update completion for Swift 5.1 (#8248)

This commit is contained in:
Tim 2019-10-22 17:24:05 +01:00 committed by Marc Cornellà
parent 534ec60bfd
commit 40df67bc3b
2 changed files with 122 additions and 114 deletions

View File

@ -2,7 +2,7 @@
## Description ## Description
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.0. 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.
To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`: To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`:

View File

@ -82,13 +82,15 @@ _swift_build() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]" "--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]" "--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]" "--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]" "--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]" "--enable-parseable-module-interfaces[]"
"--trace-resolver[]"
"(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
"--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--build-tests[Build both source and test targets]" "--build-tests[Build both source and test targets]"
"--product[Build the specified product]:Build the specified product: " "--product[Build the specified product]:Build the specified product: "
"--target[Build the specified target]:Build the specified target: " "--target[Build the specified target]:Build the specified target: "
@ -125,13 +127,15 @@ _swift_run() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]" "--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]" "--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]" "--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]" "--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]" "--enable-parseable-module-interfaces[]"
"--trace-resolver[]"
"(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
"--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--skip-build[Skip building the executable product]" "--skip-build[Skip building the executable product]"
"--build-tests[Build both source and test targets]" "--build-tests[Build both source and test targets]"
"--repl[Launch Swift REPL for the package]" "--repl[Launch Swift REPL for the package]"
@ -166,13 +170,15 @@ _swift_package() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]" "--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]" "--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]" "--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]" "--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]" "--enable-parseable-module-interfaces[]"
"--trace-resolver[]"
"(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
"--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
'(-): :->command' '(-): :->command'
'(-)*:: :->arg' '(-)*:: :->arg'
) )
@ -181,49 +187,61 @@ _swift_package() {
(command) (command)
local modes local modes
modes=( modes=(
'update:Update package dependencies' 'completion-tool:Completion tool (for shell completions)'
'describe:Describe the current package'
'resolve:Resolve package dependencies'
'tools-version:Manipulate tools version of the current package'
'unedit:Remove a package from editable mode'
'show-dependencies:Print the resolved dependency graph'
'fetch:'
'dump-package:Print parsed Package.swift as JSON' 'dump-package:Print parsed Package.swift as JSON'
'describe:Describe the current package'
'clean:Delete build artifacts'
'show-dependencies:Print the resolved dependency graph'
'init:Initialize a new package'
'unedit:Remove a package from editable mode'
'tools-version:Manipulate tools version of the current package'
'fetch:'
'resolve:Resolve package dependencies'
'reset:Reset the complete cache/build directory'
'generate-xcodeproj:Generates an Xcode project'
'edit:Put a package in editable mode' 'edit:Put a package in editable mode'
'config:Manipulate configuration of the package' 'config:Manipulate configuration of the package'
'completion-tool:Completion tool (for shell completions)' 'update:Update package dependencies'
'clean:Delete build artifacts'
'generate-xcodeproj:Generates an Xcode project'
'reset:Reset the complete cache/build directory'
'init:Initialize a new package'
) )
_describe "mode" modes _describe "mode" modes
;; ;;
(arg) (arg)
case ${words[1]} in case ${words[1]} in
(update) (completion-tool)
_swift_package_update _swift_package_completion-tool
;;
(dump-package)
_swift_package_dump-package
;; ;;
(describe) (describe)
_swift_package_describe _swift_package_describe
;; ;;
(resolve) (clean)
_swift_package_resolve _swift_package_clean
;;
(tools-version)
_swift_package_tools-version
;;
(unedit)
_swift_package_unedit
;; ;;
(show-dependencies) (show-dependencies)
_swift_package_show-dependencies _swift_package_show-dependencies
;; ;;
(init)
_swift_package_init
;;
(unedit)
_swift_package_unedit
;;
(tools-version)
_swift_package_tools-version
;;
(fetch) (fetch)
_swift_package_fetch _swift_package_fetch
;; ;;
(dump-package) (resolve)
_swift_package_dump-package _swift_package_resolve
;;
(reset)
_swift_package_reset
;;
(generate-xcodeproj)
_swift_package_generate-xcodeproj
;; ;;
(edit) (edit)
_swift_package_edit _swift_package_edit
@ -231,27 +249,22 @@ _swift_package() {
(config) (config)
_swift_package_config _swift_package_config
;; ;;
(completion-tool) (update)
_swift_package_completion-tool _swift_package_update
;;
(clean)
_swift_package_clean
;;
(generate-xcodeproj)
_swift_package_generate-xcodeproj
;;
(reset)
_swift_package_reset
;;
(init)
_swift_package_init
;; ;;
esac esac
;; ;;
esac esac
} }
_swift_package_update() { _swift_package_completion-tool() {
arguments=(
": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
)
_arguments $arguments && return
}
_swift_package_dump-package() {
arguments=( arguments=(
) )
_arguments $arguments && return _arguments $arguments && return
@ -264,6 +277,49 @@ _swift_package_describe() {
_arguments $arguments && return _arguments $arguments && return
} }
_swift_package_clean() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_show-dependencies() {
arguments=(
"--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
)
_arguments $arguments && return
}
_swift_package_init() {
arguments=(
"--type[empty|library|executable|system-module|manifest]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
"--name[Provide custom package name]:Provide custom package name: "
)
_arguments $arguments && return
}
_swift_package_unedit() {
arguments=(
":The name of the package to unedit:_swift_dependency"
"--force[Unedit the package even if it has uncommited and unpushed changes.]"
)
_arguments $arguments && return
}
_swift_package_tools-version() {
arguments=(
"--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
"--set-current[Set tools version of package to the current tools version in use]"
)
_arguments $arguments && return
}
_swift_package_fetch() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_resolve() { _swift_package_resolve() {
arguments=( arguments=(
":The name of the package to resolve:_swift_dependency" ":The name of the package to resolve:_swift_dependency"
@ -274,37 +330,20 @@ _swift_package_resolve() {
_arguments $arguments && return _arguments $arguments && return
} }
_swift_package_tools-version() { _swift_package_reset() {
arguments=(
"--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
"--set-current[Set tools version of package to the current tools version in use]"
)
_arguments $arguments && return
}
_swift_package_unedit() {
arguments=(
":The name of the package to unedit:_swift_dependency"
"--force[Unedit the package even if it has uncommited and unpushed changes.]"
)
_arguments $arguments && return
}
_swift_package_show-dependencies() {
arguments=(
"--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
)
_arguments $arguments && return
}
_swift_package_fetch() {
arguments=( arguments=(
) )
_arguments $arguments && return _arguments $arguments && return
} }
_swift_package_dump-package() { _swift_package_generate-xcodeproj() {
arguments=( arguments=(
"--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
"--enable-code-coverage[Enable code coverage in the generated project]"
"--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
"--legacy-scheme-generator[Use the legacy scheme generator]"
"--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
"--skip-extra-files[Do not add file references for extra files to the generated Xcode project]"
) )
_arguments $arguments && return _arguments $arguments && return
} }
@ -330,8 +369,8 @@ _swift_package_config() {
local modes local modes
modes=( modes=(
'unset-mirror:Remove an existing mirror' 'unset-mirror:Remove an existing mirror'
'set-mirror:Set a mirror for a dependency'
'get-mirror:Print mirror configuration for the given package dependency' 'get-mirror:Print mirror configuration for the given package dependency'
'set-mirror:Set a mirror for a dependency'
) )
_describe "mode" modes _describe "mode" modes
;; ;;
@ -340,12 +379,12 @@ _swift_package_config() {
(unset-mirror) (unset-mirror)
_swift_package_config_unset-mirror _swift_package_config_unset-mirror
;; ;;
(set-mirror)
_swift_package_config_set-mirror
;;
(get-mirror) (get-mirror)
_swift_package_config_get-mirror _swift_package_config_get-mirror
;; ;;
(set-mirror)
_swift_package_config_set-mirror
;;
esac esac
;; ;;
esac esac
@ -359,6 +398,13 @@ _swift_package_config_unset-mirror() {
_arguments $arguments && return _arguments $arguments && return
} }
_swift_package_config_get-mirror() {
arguments=(
"--package-url[The package dependency url]:The package dependency url: "
)
_arguments $arguments && return
}
_swift_package_config_set-mirror() { _swift_package_config_set-mirror() {
arguments=( arguments=(
"--package-url[The package dependency url]:The package dependency url: " "--package-url[The package dependency url]:The package dependency url: "
@ -367,48 +413,8 @@ _swift_package_config_set-mirror() {
_arguments $arguments && return _arguments $arguments && return
} }
_swift_package_config_get-mirror() { _swift_package_update() {
arguments=( arguments=(
"--package-url[The package dependency url]:The package dependency url: "
)
_arguments $arguments && return
}
_swift_package_completion-tool() {
arguments=(
": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
)
_arguments $arguments && return
}
_swift_package_clean() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_generate-xcodeproj() {
arguments=(
"--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
"--enable-code-coverage[Enable code coverage in the generated project]"
"--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
"--legacy-scheme-generator[Use the legacy scheme generator]"
"--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
"--skip-extra-files[Do not add file references for extra files to the generated Xcode project]"
)
_arguments $arguments && return
}
_swift_package_reset() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_init() {
arguments=(
"--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
"--name[Provide custom package name]:Provide custom package name: "
) )
_arguments $arguments && return _arguments $arguments && return
} }
@ -440,13 +446,15 @@ _swift_test() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]" "--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]" "--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]" "--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]" "--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]" "--enable-parseable-module-interfaces[]"
"--trace-resolver[]"
"(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
"--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--skip-build[Skip building the test target]" "--skip-build[Skip building the test target]"
"(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]" "(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]"
"--generate-linuxmain[Generate LinuxMain.swift entries for the package]" "--generate-linuxmain[Generate LinuxMain.swift entries for the package]"