my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

474 lines
21 KiB

3 years ago
  1. #compdef swift
  2. local context state state_descr line
  3. typeset -A opt_args
  4. _swift() {
  5. _arguments -C \
  6. '(- :)--help[prints the synopsis and a list of the most commonly used commands]: :->arg' \
  7. '(-): :->command' \
  8. '(-)*:: :->arg' && return
  9. case $state in
  10. (command)
  11. local tools
  12. tools=(
  13. 'build:build sources into binary products'
  14. 'run:build and run an executable product'
  15. 'package:perform operations on Swift packages'
  16. 'test:build and run tests'
  17. )
  18. _alternative \
  19. 'tools:common:{_describe "tool" tools }' \
  20. 'compiler: :_swift_compiler' && _ret=0
  21. ;;
  22. (arg)
  23. case ${words[1]} in
  24. (build)
  25. _swift_build
  26. ;;
  27. (run)
  28. _swift_run
  29. ;;
  30. (package)
  31. _swift_package
  32. ;;
  33. (test)
  34. _swift_test
  35. ;;
  36. (*)
  37. _swift_compiler
  38. ;;
  39. esac
  40. ;;
  41. esac
  42. }
  43. _swift_dependency() {
  44. local dependencies
  45. dependencies=( $(swift package completion-tool list-dependencies) )
  46. _describe '' dependencies
  47. }
  48. _swift_executable() {
  49. local executables
  50. executables=( $(swift package completion-tool list-executables) )
  51. _describe '' executables
  52. }
  53. # Generates completions for swift build
  54. #
  55. # In the final compdef file, set the following file header:
  56. #
  57. # #compdef _swift_build
  58. # local context state state_descr line
  59. # typeset -A opt_args
  60. _swift_build() {
  61. arguments=(
  62. "-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
  63. "-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
  64. "-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
  65. "-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
  66. "(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
  67. "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
  68. "(--chdir -C)"{--chdir,-C}"[]: :_files"
  69. "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
  70. "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
  71. "--disable-prefetching[]"
  72. "--skip-update[Skip updating dependencies from their remote during a resolution]"
  73. "--disable-sandbox[Disable using the sandbox when executing subprocesses]"
  74. "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
  75. "--version[]"
  76. "--destination[]: :_files"
  77. "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
  78. "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
  79. "--static-swift-stdlib[Link Swift stdlib statically]"
  80. "--force-resolved-versions[]"
  81. "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
  82. "--enable-index-store[Enable indexing-while-building feature]"
  83. "--disable-index-store[Disable indexing-while-building feature]"
  84. "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
  85. "--enable-parseable-module-interfaces[]"
  86. "--trace-resolver[]"
  87. "(--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: "
  88. "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
  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. # Generates completions for swift run
  97. #
  98. # In the final compdef file, set the following file header:
  99. #
  100. # #compdef _swift_run
  101. # local context state state_descr line
  102. # typeset -A opt_args
  103. _swift_run() {
  104. arguments=(
  105. ":The executable to run:_swift_executable"
  106. "-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
  107. "-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
  108. "-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
  109. "-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
  110. "(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
  111. "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
  112. "(--chdir -C)"{--chdir,-C}"[]: :_files"
  113. "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
  114. "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
  115. "--disable-prefetching[]"
  116. "--skip-update[Skip updating dependencies from their remote during a resolution]"
  117. "--disable-sandbox[Disable using the sandbox when executing subprocesses]"
  118. "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
  119. "--version[]"
  120. "--destination[]: :_files"
  121. "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
  122. "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
  123. "--static-swift-stdlib[Link Swift stdlib statically]"
  124. "--force-resolved-versions[]"
  125. "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
  126. "--enable-index-store[Enable indexing-while-building feature]"
  127. "--disable-index-store[Disable indexing-while-building feature]"
  128. "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
  129. "--enable-parseable-module-interfaces[]"
  130. "--trace-resolver[]"
  131. "(--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: "
  132. "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
  133. "--skip-build[Skip building the executable product]"
  134. "--build-tests[Build both source and test targets]"
  135. "--repl[Launch Swift REPL for the package]"
  136. )
  137. _arguments $arguments && return
  138. }
  139. # Generates completions for swift package
  140. #
  141. # In the final compdef file, set the following file header:
  142. #
  143. # #compdef _swift_package
  144. # local context state state_descr line
  145. # typeset -A opt_args
  146. _swift_package() {
  147. arguments=(
  148. "-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
  149. "-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
  150. "-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
  151. "-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
  152. "(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
  153. "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
  154. "(--chdir -C)"{--chdir,-C}"[]: :_files"
  155. "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
  156. "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
  157. "--disable-prefetching[]"
  158. "--skip-update[Skip updating dependencies from their remote during a resolution]"
  159. "--disable-sandbox[Disable using the sandbox when executing subprocesses]"
  160. "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
  161. "--version[]"
  162. "--destination[]: :_files"
  163. "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
  164. "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
  165. "--static-swift-stdlib[Link Swift stdlib statically]"
  166. "--force-resolved-versions[]"
  167. "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
  168. "--enable-index-store[Enable indexing-while-building feature]"
  169. "--disable-index-store[Disable indexing-while-building feature]"
  170. "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
  171. "--enable-parseable-module-interfaces[]"
  172. "--trace-resolver[]"
  173. "(--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: "
  174. "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
  175. '(-): :->command'
  176. '(-)*:: :->arg'
  177. )
  178. _arguments $arguments && return
  179. case $state in
  180. (command)
  181. local modes
  182. modes=(
  183. 'completion-tool:Completion tool (for shell completions)'
  184. 'dump-package:Print parsed Package.swift as JSON'
  185. 'describe:Describe the current package'
  186. 'clean:Delete build artifacts'
  187. 'show-dependencies:Print the resolved dependency graph'
  188. 'init:Initialize a new package'
  189. 'unedit:Remove a package from editable mode'
  190. 'tools-version:Manipulate tools version of the current package'
  191. 'fetch:'
  192. 'resolve:Resolve package dependencies'
  193. 'reset:Reset the complete cache/build directory'
  194. 'generate-xcodeproj:Generates an Xcode project'
  195. 'edit:Put a package in editable mode'
  196. 'config:Manipulate configuration of the package'
  197. 'update:Update package dependencies'
  198. )
  199. _describe "mode" modes
  200. ;;
  201. (arg)
  202. case ${words[1]} in
  203. (completion-tool)
  204. _swift_package_completion-tool
  205. ;;
  206. (dump-package)
  207. _swift_package_dump-package
  208. ;;
  209. (describe)
  210. _swift_package_describe
  211. ;;
  212. (clean)
  213. _swift_package_clean
  214. ;;
  215. (show-dependencies)
  216. _swift_package_show-dependencies
  217. ;;
  218. (init)
  219. _swift_package_init
  220. ;;
  221. (unedit)
  222. _swift_package_unedit
  223. ;;
  224. (tools-version)
  225. _swift_package_tools-version
  226. ;;
  227. (fetch)
  228. _swift_package_fetch
  229. ;;
  230. (resolve)
  231. _swift_package_resolve
  232. ;;
  233. (reset)
  234. _swift_package_reset
  235. ;;
  236. (generate-xcodeproj)
  237. _swift_package_generate-xcodeproj
  238. ;;
  239. (edit)
  240. _swift_package_edit
  241. ;;
  242. (config)
  243. _swift_package_config
  244. ;;
  245. (update)
  246. _swift_package_update
  247. ;;
  248. esac
  249. ;;
  250. esac
  251. }
  252. _swift_package_completion-tool() {
  253. arguments=(
  254. ": :{_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]'}"
  255. )
  256. _arguments $arguments && return
  257. }
  258. _swift_package_dump-package() {
  259. arguments=(
  260. )
  261. _arguments $arguments && return
  262. }
  263. _swift_package_describe() {
  264. arguments=(
  265. "--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}"
  266. )
  267. _arguments $arguments && return
  268. }
  269. _swift_package_clean() {
  270. arguments=(
  271. )
  272. _arguments $arguments && return
  273. }
  274. _swift_package_show-dependencies() {
  275. arguments=(
  276. "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
  277. )
  278. _arguments $arguments && return
  279. }
  280. _swift_package_init() {
  281. arguments=(
  282. "--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]'}"
  283. "--name[Provide custom package name]:Provide custom package name: "
  284. )
  285. _arguments $arguments && return
  286. }
  287. _swift_package_unedit() {
  288. arguments=(
  289. ":The name of the package to unedit:_swift_dependency"
  290. "--force[Unedit the package even if it has uncommited and unpushed changes.]"
  291. )
  292. _arguments $arguments && return
  293. }
  294. _swift_package_tools-version() {
  295. arguments=(
  296. "--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
  297. "--set-current[Set tools version of package to the current tools version in use]"
  298. )
  299. _arguments $arguments && return
  300. }
  301. _swift_package_fetch() {
  302. arguments=(
  303. )
  304. _arguments $arguments && return
  305. }
  306. _swift_package_resolve() {
  307. arguments=(
  308. ":The name of the package to resolve:_swift_dependency"
  309. "--version[The version to resolve at]:The version to resolve at: "
  310. "--branch[The branch to resolve at]:The branch to resolve at: "
  311. "--revision[The revision to resolve at]:The revision to resolve at: "
  312. )
  313. _arguments $arguments && return
  314. }
  315. _swift_package_reset() {
  316. arguments=(
  317. )
  318. _arguments $arguments && return
  319. }
  320. _swift_package_generate-xcodeproj() {
  321. arguments=(
  322. "--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
  323. "--enable-code-coverage[Enable code coverage in the generated project]"
  324. "--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
  325. "--legacy-scheme-generator[Use the legacy scheme generator]"
  326. "--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
  327. "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]"
  328. )
  329. _arguments $arguments && return
  330. }
  331. _swift_package_edit() {
  332. arguments=(
  333. ":The name of the package to edit:_swift_dependency"
  334. "--revision[The revision to edit]:The revision to edit: "
  335. "--branch[The branch to create]:The branch to create: "
  336. "--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files"
  337. )
  338. _arguments $arguments && return
  339. }
  340. _swift_package_config() {
  341. arguments=(
  342. '(-): :->command'
  343. '(-)*:: :->arg'
  344. )
  345. _arguments $arguments && return
  346. case $state in
  347. (command)
  348. local modes
  349. modes=(
  350. 'unset-mirror:Remove an existing mirror'
  351. 'get-mirror:Print mirror configuration for the given package dependency'
  352. 'set-mirror:Set a mirror for a dependency'
  353. )
  354. _describe "mode" modes
  355. ;;
  356. (arg)
  357. case ${words[1]} in
  358. (unset-mirror)
  359. _swift_package_config_unset-mirror
  360. ;;
  361. (get-mirror)
  362. _swift_package_config_get-mirror
  363. ;;
  364. (set-mirror)
  365. _swift_package_config_set-mirror
  366. ;;
  367. esac
  368. ;;
  369. esac
  370. }
  371. _swift_package_config_unset-mirror() {
  372. arguments=(
  373. "--package-url[The package dependency url]:The package dependency url: "
  374. "--mirror-url[The mirror url]:The mirror url: "
  375. )
  376. _arguments $arguments && return
  377. }
  378. _swift_package_config_get-mirror() {
  379. arguments=(
  380. "--package-url[The package dependency url]:The package dependency url: "
  381. )
  382. _arguments $arguments && return
  383. }
  384. _swift_package_config_set-mirror() {
  385. arguments=(
  386. "--package-url[The package dependency url]:The package dependency url: "
  387. "--mirror-url[The mirror url]:The mirror url: "
  388. )
  389. _arguments $arguments && return
  390. }
  391. _swift_package_update() {
  392. arguments=(
  393. )
  394. _arguments $arguments && return
  395. }
  396. # Generates completions for swift test
  397. #
  398. # In the final compdef file, set the following file header:
  399. #
  400. # #compdef _swift_test
  401. # local context state state_descr line
  402. # typeset -A opt_args
  403. _swift_test() {
  404. arguments=(
  405. "-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
  406. "-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
  407. "-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
  408. "-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
  409. "(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
  410. "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
  411. "(--chdir -C)"{--chdir,-C}"[]: :_files"
  412. "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
  413. "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
  414. "--disable-prefetching[]"
  415. "--skip-update[Skip updating dependencies from their remote during a resolution]"
  416. "--disable-sandbox[Disable using the sandbox when executing subprocesses]"
  417. "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
  418. "--version[]"
  419. "--destination[]: :_files"
  420. "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
  421. "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
  422. "--static-swift-stdlib[Link Swift stdlib statically]"
  423. "--force-resolved-versions[]"
  424. "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
  425. "--enable-index-store[Enable indexing-while-building feature]"
  426. "--disable-index-store[Disable indexing-while-building feature]"
  427. "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
  428. "--enable-parseable-module-interfaces[]"
  429. "--trace-resolver[]"
  430. "(--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: "
  431. "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
  432. "--skip-build[Skip building the test target]"
  433. "(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]"
  434. "--generate-linuxmain[Generate LinuxMain.swift entries for the package]"
  435. "--parallel[Run the tests in parallel.]"
  436. "--num-workers[Number of tests to execute in parallel.]:Number of tests to execute in parallel.: "
  437. "(--specifier -s)"{--specifier,-s}"[]: : "
  438. "--xunit-output[]: :_files"
  439. "--filter[Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>]:Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>: "
  440. "--enable-code-coverage[Test with code coverage enabled]"
  441. )
  442. _arguments $arguments && return
  443. }
  444. _swift_compiler() {
  445. }
  446. _swift