af1ee2b9940de7f758669575560d8e32b9975cba

Author
Henrik Johansson <henrik.johansson@eniro.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Add plugin for Gb completion (http://getgb.io)

Diff

This diff is truncated to protect this page.

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