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.

111 lines
3.0 KiB

3 years ago
  1. #compdef gb
  2. #autoload
  3. _gb () {
  4. local ret=1 state
  5. _arguments -C ':command:->command' '*::options:->options' && ret=0
  6. case $state in
  7. (command)
  8. local -a subcommands
  9. subcommands=(
  10. "build:build a package"
  11. "doc:show documentation for a package or symbol"
  12. "env:print project environment variables"
  13. "generate:generate Go files by processing source"
  14. "help:displays the help"
  15. "info:info returns information about this project"
  16. "list:list the packages named by the importpaths"
  17. "test:test packages"
  18. "vendor:manage your vendored dependencies"
  19. )
  20. _describe -t subcommands 'gb subcommands' subcommands && ret=0
  21. ;;
  22. (options)
  23. case $line[1] in
  24. (build)
  25. _arguments \
  26. -f'[ignore cached packages]' \
  27. -F'[do not cache packages]' \
  28. -q'[decreases verbosity]' \
  29. -P'[the number of build jobs to run in parallel]' \
  30. -R'[sets the base of the project root search path]' \
  31. -dotfile'[output a dot formatted file of the build steps]' \
  32. -ldflags'["flag list" arguments to pass to the linker]' \
  33. -gcflags'["arg list" arguments to pass to the compiler]' \
  34. -race'[enable data race detection]' \
  35. -tags'["tag list" additional build tags]'
  36. ;;
  37. (list)
  38. _arguments \
  39. -f'[alternate format for the list, using the syntax of package template]' \
  40. -s'[read format template from STDIN]' \
  41. -json'[prints output in structured JSON format]'
  42. ;;
  43. (test)
  44. _arguments \
  45. -v'[print output from test subprocess]' \
  46. -ldflags'["flag list" arguments to pass to the linker]' \
  47. -gcflags'["arg list" arguments to pass to the compiler]' \
  48. -race'[enable data race detection]' \
  49. -tags'["tag list" additional build tags]'
  50. ;;
  51. (vendor)
  52. _gb-vendor
  53. esac
  54. ;;
  55. esac
  56. return ret
  57. }
  58. _gb-vendor () {
  59. local curcontext="$curcontext" state line
  60. _arguments -C ':command:->command' '*::options:->options'
  61. case $state in
  62. (command)
  63. local -a subcommands
  64. subcommands=(
  65. 'delete:deletes a local dependency'
  66. 'fetch:fetch a remote dependency'
  67. 'list:lists dependencies, one per line'
  68. 'purge:remove all unreferenced dependencies'
  69. 'restore:restore dependencies from the manifest'
  70. 'update:update a local dependency'
  71. )
  72. _describe -t subcommands 'gb vendor subcommands' subcommands && ret=0
  73. ;;
  74. (options)
  75. case $line[1] in
  76. (delete)
  77. _arguments \
  78. -all'[remove all dependencies]'
  79. ;;
  80. (fetch)
  81. _arguments \
  82. -branch'[fetch from a particular branch]' \
  83. -no-recurse'[do not fetch recursively]' \
  84. -tag'[fetch the specified tag]' \
  85. -revision'[fetch the specific revision from the branch (if supplied)]' \
  86. -precaire'[allow the use of insecure protocols]' \
  87. ;;
  88. (list)
  89. _arguments \
  90. -f'[controls the template used for printing each manifest entry]'
  91. ;;
  92. (restore)
  93. _arguments \
  94. -precaire'[allow the use of insecure protocols]'
  95. ;;
  96. (update)
  97. _arguments \
  98. -all'[update all dependencies in the manifest or supply a given dependency]' \
  99. -precaire'[allow the use of insecure protocols]'
  100. ;;
  101. esac
  102. ;;
  103. esac
  104. }
  105. _gb