9624ce992ec3482041c3086bc88f0485eb8d9bd3
- Author
- Thi <thii@users.noreply.github.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift
2new file mode 100644
3index 0000000000000000000000000000000000000000..901b5d9e2f1c60aad69e16a6696f0481c9fe2984
4--- /dev/null
5+++ b/plugins/swiftpm/_swift
6@@ -0,0 +1,362 @@
7+#compdef swift
8+local context state state_descr line
9+typeset -A opt_args
10+
11+_swift() {
12+ _arguments -C \
13+ '(- :)--help[prints the synopsis and a list of the most commonly used commands]: :->arg' \
14+ '(-): :->command' \
15+ '(-)*:: :->arg' && return
16+
17+ case $state in
18+ (command)
19+ local tools
20+ tools=(
21+ 'build:build sources into binary products'
22+ 'run:build and run an executable product'
23+ 'package:perform operations on Swift packages'
24+ 'test:build and run tests'
25+ )
26+ _alternative \
27+ 'tools:common:{_describe "tool" tools }' \
28+ 'compiler: :_swift_compiler' && _ret=0
29+ ;;
30+ (arg)
31+ case ${words[1]} in
32+ (build)
33+ _swift_build
34+ ;;
35+ (run)
36+ _swift_run
37+ ;;
38+ (package)
39+ _swift_package
40+ ;;
41+ (test)
42+ _swift_test
43+ ;;
44+ (*)
45+ _swift_compiler
46+ ;;
47+ esac
48+ ;;
49+ esac
50+}
51+
52+_swift_dependency() {
53+ local dependencies
54+ dependencies=( $(swift package completion-tool list-dependencies) )
55+ _describe '' dependencies
56+}
57+
58+_swift_executable() {
59+ local executables
60+ executables=( $(swift package completion-tool list-executables) )
61+ _describe '' executables
62+}
63+
64+# Generates completions for swift build
65+#
66+# In the final compdef file, set the following file header:
67+#
68+# #compdef _swift_build
69+# local context state state_descr line
70+# typeset -A opt_args
71+_swift_build() {
72+ arguments=(
73+ "-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
74+ "-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
75+ "-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
76+ "-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
77+ "(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
78+ "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
79+ "(--chdir -C)"{--chdir,-C}"[]: :_files"
80+ "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
81+ "--disable-prefetching[]"
82+ "--disable-sandbox[Disable using the sandbox when executing subprocesses]"
83+ "--version[]"
84+ "--destination[]: :_files"
85+ "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
86+ "--no-static-swift-stdlib[Do not link Swift stdlib statically]"
87+ "--static-swift-stdlib[Link Swift stdlib statically]"
88+ "--enable-build-manifest-caching[Enable llbuild manifest caching [Experimental]]"
89+ "--build-tests[Build both source and test targets]"
90+ "--product[Build the specified product]:Build the specified product: "
91+ "--target[Build the specified target]:Build the specified target: "
92+ "--show-bin-path[Print the binary output path]"
93+ )
94+ _arguments $arguments && return
95+}
96+
97+# Generates completions for swift run
98+#
99+# In the final compdef file, set the following file header:
100+#
101+# #compdef _swift_run
102+# local context state state_descr line
103+# typeset -A opt_args
104+_swift_run() {
105+ arguments=(