644bc641ad48c74c88631d79d48ec9b6f3f5a3e5
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/gb/README.md b/plugins/gb/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..822c29aaa67bea2db96e7906cffe9bee15e08089
4--- /dev/null
5+++ b/plugins/gb/README.md
6@@ -0,0 +1,21 @@
7+# `gb` plugin
8+
9+> A project based build tool for the Go programming language.
10+
11+See https://getgb.io for the full `gb` documentation
12+
13+* * * *
14+
15+- Adds completion support for all `gb` commands.
16+- Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor).
17+
18+To use it, add `gb` to your plugins array:
19+```sh
20+plugins=(... gb)
21+```
22+
23+## Caveats
24+
25+The `git` plugin defines an alias `gb` that usually conflicts with the `gb` program.
26+If you're having trouble with it, remove it by adding `unalias gb` at the end of your
27+zshrc file.
28diff --git a/plugins/gb/_gb b/plugins/gb/_gb
29new file mode 100644
30index 0000000000000000000000000000000000000000..8148adf1604032dd19bf2a64f83c9065f5296259
31--- /dev/null
32+++ b/plugins/gb/_gb
33@@ -0,0 +1,111 @@
34+#compdef gb
35+#autoload
36+
37+_gb () {
38+ local ret=1 state
39+ _arguments -C ':command:->command' '*::options:->options' && ret=0
40+
41+ case $state in
42+ (command)
43+ local -a subcommands
44+ subcommands=(
45+ "build:build a package"
46+ "doc:show documentation for a package or symbol"
47+ "env:print project environment variables"
48+ "generate:generate Go files by processing source"
49+ "help:displays the help"
50+ "info:info returns information about this project"
51+ "list:list the packages named by the importpaths"
52+ "test:test packages"
53+ "vendor:manage your vendored dependencies"
54+ )
55+ _describe -t subcommands 'gb subcommands' subcommands && ret=0
56+ ;;
57+ (options)
58+ case $line[1] in
59+ (build)
60+ _arguments \
61+ -f'[ignore cached packages]' \
62+ -F'[do not cache packages]' \
63+ -q'[decreases verbosity]' \
64+ -P'[the number of build jobs to run in parallel]' \
65+ -R'[sets the base of the project root search path]' \
66+ -dotfile'[output a dot formatted file of the build steps]' \
67+ -ldflags'["flag list" arguments to pass to the linker]' \
68+ -gcflags'["arg list" arguments to pass to the compiler]' \
69+ -race'[enable data race detection]' \
70+ -tags'["tag list" additional build tags]'
71+ ;;
72+ (list)
73+ _arguments \
74+ -f'[alternate format for the list, using the syntax of package template]' \
75+ -s'[read format template from STDIN]' \
76+ -json'[prints output in structured JSON format]'
77+ ;;
78+ (test)
79+ _arguments \
80+ -v'[print output from test subprocess]' \
81+ -ldflags'["flag list" arguments to pass to the linker]' \
82+ -gcflags'["arg list" arguments to pass to the compiler]' \
83+ -race'[enable data race detection]' \
84+ -tags'["tag list" additional build tags]'
85+ ;;
86+ (vendor)
87+ _gb-vendor
88+ esac
89+ ;;
90+ esac
91+
92+ return ret
93+}
94+
95+_gb-vendor () {
96+ local curcontext="$curcontext" state line
97+ _arguments -C ':command:->command' '*::options:->options'
98+
99+ case $state in
100+ (command)
101+ local -a subcommands
102+ subcommands=(
103+ 'delete:deletes a local dependency'
104+ 'fetch:fetch a remote dependency'
105+ 'list:lists dependencies, one per line'
106+ 'purge:remove all unreferenced dependencies'
107+ 'restore:restore dependencies from the manifest'
108+ 'update:update a local dependency'
109+ )
110+ _describe -t subcommands 'gb vendor subcommands' subcommands && ret=0
111+ ;;
112+ (options)
113+ case $line[1] in
114+ (delete)
115+ _arguments \
116+ -all'[remove all dependencies]'
117+ ;;
118+ (fetch)
119+ _arguments \
120+ -branch'[fetch from a particular branch]' \
121+ -no-recurse'[do not fetch recursively]' \
122+ -tag'[fetch the specified tag]' \
123+ -revision'[fetch the specific revision from the branch (if supplied)]' \
124+ -precaire'[allow the use of insecure protocols]' \
125+ ;;
126+ (list)
127+ _arguments \
128+ -f'[controls the template used for printing each manifest entry]'
129+ ;;
130+ (restore)
131+ _arguments \
132+ -precaire'[allow the use of insecure protocols]'