parent
d0ea3f22b1
commit
a29f8f7659
1 changed files with 97 additions and 103 deletions
@ -1,114 +1,108 @@ |
|||||||
function _gb_commands() { |
_gb () { |
||||||
local ret=1 state |
local ret=1 state |
||||||
_arguments -C ':command:->command' '*::options:->options' && ret=0 |
_arguments -C ':command:->command' '*::options:->options' && ret=0 |
||||||
|
|
||||||
case $state in |
case $state in |
||||||
(command) |
(command) |
||||||
|
local -a subcommands |
||||||
local -a subcommands |
subcommands=( |
||||||
subcommands=( |
"build:build a package" |
||||||
"build:build a package" |
"doc:show documentation for a package or symbol" |
||||||
"doc:show documentation for a package or symbol" |
"env:print project environment variables" |
||||||
"env:print project environment variables" |
"generate:generate Go files by processing source" |
||||||
"generate:generate Go files by processing source" |
"help:displays the help" |
||||||
"help:displays the help" |
"info:info returns information about this project" |
||||||
"info:info returns information about this project" |
"list:list the packages named by the importpaths" |
||||||
"list:list the packages named by the importpaths" |
"test:test packages" |
||||||
"test:test packages" |
"vendor:manage your vendored dependencies" |
||||||
"vendor:manage your vendored dependencies" |
) |
||||||
) |
_describe -t subcommands 'gb subcommands' subcommands && ret=0 |
||||||
_describe -t subcommands 'gb subcommands' subcommands && ret=0 |
;; |
||||||
;; |
(options) |
||||||
|
case $line[1] in |
||||||
(options) |
(build) |
||||||
case $line[1] in |
_arguments \ |
||||||
(build) |
-f'[ignore cached packages]' \ |
||||||
_arguments \ |
-F'[do not cache packages]' \ |
||||||
-f'[ignore cached packages]' \ |
-q'[decreases verbosity]' \ |
||||||
-F'[do not cache packages]' \ |
-P'[the number of build jobs to run in parallel]' \ |
||||||
-q'[decreases verbosity]' \ |
-R'[sets the base of the project root search path]' \ |
||||||
-P'[the number of build jobs to run in parallel]' \ |
-dotfile'[output a dot formatted file of the build steps]' \ |
||||||
-R'[sets the base of the project root search path]' \ |
-ldflags'["flag list" arguments to pass to the linker]' \ |
||||||
-dotfile'[output a dot formatted file of the build steps]' \ |
-gcflags'["arg list" arguments to pass to the compiler]' \ |
||||||
-ldflags'["flag list" arguments to pass to the linker]' \ |
-race'[enable data race detection]' \ |
||||||
-gcflags'["arg list" arguments to pass to the compiler]' \ |
-tags'["tag list" additional build tags]' |
||||||
-race'[enable data race detection]' \ |
;; |
||||||
-tags'["tag list" additional build tags]' |
(list) |
||||||
;; |
_arguments \ |
||||||
(list) |
-f'[alternate format for the list, using the syntax of package template]' \ |
||||||
_arguments \ |
-s'[read format template from STDIN]' \ |
||||||
-f'[alternate format for the list, using the syntax of package template]' \ |
-json'[prints output in structured JSON format]' |
||||||
-s'[read format template from STDIN]' \ |
;; |
||||||
-json'[prints output in structured JSON format]' |
(test) |
||||||
;; |
_arguments \ |
||||||
(test) |
-v'[print output from test subprocess]' \ |
||||||
_arguments \ |
-ldflags'["flag list" arguments to pass to the linker]' \ |
||||||
-v'[print output from test subprocess]' \ |
-gcflags'["arg list" arguments to pass to the compiler]' \ |
||||||
-ldflags'["flag list" arguments to pass to the linker]' \ |
-race'[enable data race detection]' \ |
||||||
-gcflags'["arg list" arguments to pass to the compiler]' \ |
-tags'["tag list" additional build tags]' |
||||||
-race'[enable data race detection]' \ |
;; |
||||||
-tags'["tag list" additional build tags]' |
(vendor) |
||||||
;; |
_gb-vendor |
||||||
(vendor) |
esac |
||||||
__gb-vendor |
;; |
||||||
esac |
esac |
||||||
;; |
|
||||||
esac |
|
||||||
|
|
||||||
return ret |
return ret |
||||||
} |
} |
||||||
|
|
||||||
compdef _gb_commands gb |
compdef _gb gb |
||||||
|
|
||||||
__gb-vendor () |
|
||||||
{ |
|
||||||
local curcontext="$curcontext" state line |
|
||||||
|
|
||||||
_arguments -C ':command:->command' '*::options:->options' |
_gb-vendor () { |
||||||
|
local curcontext="$curcontext" state line |
||||||
|
_arguments -C ':command:->command' '*::options:->options' |
||||||
|
|
||||||
case $state in |
case $state in |
||||||
(command) |
(command) |
||||||
|
local -a subcommands |
||||||
local -a subcommands |
subcommands=( |
||||||
subcommands=( |
'delete:deletes a local dependency' |
||||||
'delete:deletes a local dependency' |
'fetch:fetch a remote dependency' |
||||||
'fetch:fetch a remote dependency' |
'list:lists dependencies, one per line' |
||||||
'list:lists dependencies, one per line' |
'purge:remove all unreferenced dependencies' |
||||||
'purge:remove all unreferenced dependencies' |
'restore:restore dependencies from the manifest' |
||||||
'restore:restore dependencies from the manifest' |
'update:update a local dependency' |
||||||
'update:update a local dependency' |
) |
||||||
) |
_describe -t subcommands 'gb vendor subcommands' subcommands && ret=0 |
||||||
_describe -t subcommands 'gb vendor subcommands' subcommands && ret=0 |
|
||||||
;; |
;; |
||||||
|
(options) |
||||||
(options) |
case $line[1] in |
||||||
case $line[1] in |
(delete) |
||||||
(delete) |
_arguments \ |
||||||
_arguments \ |
-all'[remove all dependencies]' |
||||||
-all'[remove all dependencies]' |
;; |
||||||
;; |
(fetch) |
||||||
(fetch) |
_arguments \ |
||||||
_arguments \ |
-branch'[fetch from a particular branch]' \ |
||||||
-branch'[fetch from a particular branch]' \ |
-no-recurse'[do not fetch recursively]' \ |
||||||
-no-recurse'[do not fetch recursively]' \ |
-tag'[fetch the specified tag]' \ |
||||||
-tag'[fetch the specified tag]' \ |
-revision'[fetch the specific revision from the branch (if supplied)]' \ |
||||||
-revision'[fetch the specific revision from the branch (if supplied)]' \ |
-precaire'[allow the use of insecure protocols]' \ |
||||||
-precaire'[allow the use of insecure protocols]' \ |
;; |
||||||
;; |
(list) |
||||||
(list) |
_arguments \ |
||||||
_arguments \ |
-f'[controls the template used for printing each manifest entry]' |
||||||
-f'[controls the template used for printing each manifest entry]' |
;; |
||||||
;; |
(restore) |
||||||
(restore) |
_arguments \ |
||||||
_arguments \ |
-precaire'[allow the use of insecure protocols]' |
||||||
-precaire'[allow the use of insecure protocols]' |
;; |
||||||
;; |
(update) |
||||||
(update) |
_arguments \ |
||||||
_arguments \ |
-all'[update all dependencies in the manifest or supply a given dependency]' \ |
||||||
-all'[update all dependencies in the manifest or supply a given dependency]' \ |
-precaire'[allow the use of insecure protocols]' |
||||||
-precaire'[allow the use of insecure protocols]' |
;; |
||||||
;; |
esac |
||||||
esac |
|
||||||
;; |
;; |
||||||
esac |
esac |
||||||
} |
} |
||||||
|
|||||||
Loading…
Reference in new issue