From 909fcef0469a2706508c0197e14aa45654702044 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Tue, 21 Jun 2016 00:45:55 +0530 Subject: [PATCH 01/10] Fix issue with `dash` as the default `/bin/sh` script executing program. (#5177) * `function` keyword removed * Fixup the `if` statement and operators --- plugins/emacs/emacsclient.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index d61ebb15..41682512 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -1,6 +1,6 @@ #!/bin/sh -function _emacsfun +_emacsfun() { # get list of available X windows. x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null` @@ -18,7 +18,8 @@ function _emacsfun # adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh # If the second argument is - then write stdin to a tempfile and open the # tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh) -if [[ $# -ge 2 ]] && [[ "$2" == - ]]; then +if [ "$#" -ge "2" -a "$2" = "-" ] +then tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)" cat - > "$tempfile" _emacsfun --no-wait $tempfile From 9a61336d33a8a6258c0fb838bfa3c9c488e7d898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 20 Jun 2016 22:19:02 +0200 Subject: [PATCH 02/10] Fix man-preview completion definition Related: #5179 --- plugins/osx/osx.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index c66325cd..4dbc7578 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -175,7 +175,7 @@ function quick-look() { function man-preview() { man -t "$@" | open -f -a Preview } -compdef man-preview=man +compdef _man man-preview function vncviewer() { open vnc://$@ From c62442f999854038e7d0911f60a4aff252913a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 21 Jun 2016 01:06:21 +0200 Subject: [PATCH 03/10] Fix gfg function completion definition Related: #5179 --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index eb7bc803..c186a6e1 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -88,7 +88,7 @@ alias gdw='git diff --word-diff' alias gf='git fetch' alias gfa='git fetch --all --prune' function gfg() { git ls-files | grep $@ } -compdef gfg=grep +compdef _grep gfg alias gfo='git fetch origin' alias gg='git gui citool' From 7fabc8bca41d4ff7090325116a85513dac852236 Mon Sep 17 00:00:00 2001 From: Clemens Gruber Date: Tue, 21 Jun 2016 01:31:13 +0200 Subject: [PATCH 04/10] bundler plugin: Simplify retrieval of cpu count on OSX (#5180) Calling awk is not necessary here, sysctl has the -n flag to print the value. Signed-off-by: Clemens Gruber --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 382a1a47..c5284dbb 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -58,7 +58,7 @@ bundle_install() { if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then if [[ "$OSTYPE" = darwin* ]] then - local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" + local cores_num="$(sysctl -n hw.ncpu)" else local cores_num="$(nproc)" fi From af1ee2b9940de7f758669575560d8e32b9975cba Mon Sep 17 00:00:00 2001 From: Henrik Johansson Date: Sun, 19 Jun 2016 10:52:17 +0200 Subject: [PATCH 05/10] Add plugin for Gb completion (http://getgb.io) --- plugins/getgb/getgb.plugin.zsh | 114 +++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 plugins/getgb/getgb.plugin.zsh diff --git a/plugins/getgb/getgb.plugin.zsh b/plugins/getgb/getgb.plugin.zsh new file mode 100644 index 00000000..9efb00c9 --- /dev/null +++ b/plugins/getgb/getgb.plugin.zsh @@ -0,0 +1,114 @@ +function _gb_commands() { + local ret=1 state + _arguments -C ':command:->command' '*::options:->options' && ret=0 + + case $state in + (command) + + local -a subcommands + subcommands=( + "build:build a package" + "doc:show documentation for a package or symbol" + "env:print project environment variables" + "generate:generate Go files by processing source" + "help:displays the help" + "info:info returns information about this project" + "list:list the packages named by the importpaths" + "test:test packages" + "vendor:manage your vendored dependencies" + ) + _describe -t subcommands 'gb subcommands' subcommands && ret=0 + ;; + + (options) + case $line[1] in + (build) + _arguments \ + -f'[ignore cached packages]' \ + -F'[do not cache packages]' \ + -q'[decreases verbosity]' \ + -P'[the number of build jobs to run in parallel]' \ + -R'[sets the base of the project root search path]' \ + -dotfile'[output a dot formatted file of the build steps]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (list) + _arguments \ + -f'[alternate format for the list, using the syntax of package template]' \ + -s'[read format template from STDIN]' \ + -json'[prints output in structured JSON format]' + ;; + (test) + _arguments \ + -v'[print output from test subprocess]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (vendor) + __gb-vendor + esac + ;; + esac + + return ret +} + +compdef _gb_commands gb + +__gb-vendor () +{ + local curcontext="$curcontext" state line + + _arguments -C ':command:->command' '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'delete:deletes a local dependency' + 'fetch:fetch a remote dependency' + 'list:lists dependencies, one per line' + 'purge:remove all unreferenced dependencies' + 'restore:restore dependencies from the manifest' + 'update:update a local dependency' + ) + _describe -t subcommands 'gb vendor subcommands' subcommands && ret=0 + ;; + + (options) + case $line[1] in + (delete) + _arguments \ + -all'[remove all dependencies]' + ;; + (fetch) + _arguments \ + -branch'[fetch from a particular branch]' \ + -no-recurse'[do not fetch recursively]' \ + -tag'[fetch the specified tag]' \ + -revision'[fetch the specific revision from the branch (if supplied)]' \ + -precaire'[allow the use of insecure protocols]' \ + ;; + (list) + _arguments \ + -f'[controls the template used for printing each manifest entry]' + ;; + (restore) + _arguments \ + -precaire'[allow the use of insecure protocols]' + ;; + (update) + _arguments \ + -all'[update all dependencies in the manifest or supply a given dependency]' \ + -precaire'[allow the use of insecure protocols]' + ;; + esac + ;; + esac +} From 57a689ffd5dd54852afeea38e5c401d5a29b4493 Mon Sep 17 00:00:00 2001 From: Henrik Johansson Date: Tue, 28 Jun 2016 21:25:51 +0200 Subject: [PATCH 06/10] Add README to gb plugin --- plugins/getgb/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/getgb/README.md diff --git a/plugins/getgb/README.md b/plugins/getgb/README.md new file mode 100644 index 00000000..b477b0f4 --- /dev/null +++ b/plugins/getgb/README.md @@ -0,0 +1,10 @@ +# *gb* plugin + +- aims to support completion for all *gb* commands +- also supports completion for *gb* plugins such as *vendor* + +See http://getgb.io for the full *gb* documentation + +## Caveats + +- The *git* plugin installs an alias *gb* that usually conflicts with the *gb* program From d0ea3f22b1099ce98e0fc02b6074d862478ae81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 2 Jul 2016 11:59:04 +0200 Subject: [PATCH 07/10] Add more information to the README --- plugins/getgb/README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/plugins/getgb/README.md b/plugins/getgb/README.md index b477b0f4..88881cb2 100644 --- a/plugins/getgb/README.md +++ b/plugins/getgb/README.md @@ -1,10 +1,21 @@ -# *gb* plugin +# `gb` plugin -- aims to support completion for all *gb* commands -- also supports completion for *gb* plugins such as *vendor* +> A project based build tool for the Go programming language. -See http://getgb.io for the full *gb* documentation +See https://getgb.io for the full `gb` documentation + +* * * * + +- Adds completion support for all `gb` commands. +- Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor). + +To use it, add `getgb` to your plugins array: +```sh +plugins=(... getgb) +``` ## Caveats -- The *git* plugin installs an alias *gb* that usually conflicts with the *gb* program +The `git` plugin defines an alias `gb` that usually conflicts with the `gb` program. +If you're having trouble with it, remove it by adding `unalias gb` at the end of your +zshrc file. From a29f8f76599e93653f006c2e074bd1dc47cc9b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 2 Jul 2016 16:24:02 +0200 Subject: [PATCH 08/10] Fix formatting of gb plugin completion --- plugins/getgb/getgb.plugin.zsh | 208 ++++++++++++++++----------------- 1 file changed, 101 insertions(+), 107 deletions(-) diff --git a/plugins/getgb/getgb.plugin.zsh b/plugins/getgb/getgb.plugin.zsh index 9efb00c9..726f0a24 100644 --- a/plugins/getgb/getgb.plugin.zsh +++ b/plugins/getgb/getgb.plugin.zsh @@ -1,114 +1,108 @@ -function _gb_commands() { - local ret=1 state - _arguments -C ':command:->command' '*::options:->options' && ret=0 - - case $state in - (command) - - local -a subcommands - subcommands=( - "build:build a package" - "doc:show documentation for a package or symbol" - "env:print project environment variables" - "generate:generate Go files by processing source" - "help:displays the help" - "info:info returns information about this project" - "list:list the packages named by the importpaths" - "test:test packages" - "vendor:manage your vendored dependencies" - ) - _describe -t subcommands 'gb subcommands' subcommands && ret=0 - ;; - - (options) - case $line[1] in - (build) - _arguments \ - -f'[ignore cached packages]' \ - -F'[do not cache packages]' \ - -q'[decreases verbosity]' \ - -P'[the number of build jobs to run in parallel]' \ - -R'[sets the base of the project root search path]' \ - -dotfile'[output a dot formatted file of the build steps]' \ - -ldflags'["flag list" arguments to pass to the linker]' \ - -gcflags'["arg list" arguments to pass to the compiler]' \ - -race'[enable data race detection]' \ - -tags'["tag list" additional build tags]' - ;; - (list) - _arguments \ - -f'[alternate format for the list, using the syntax of package template]' \ - -s'[read format template from STDIN]' \ - -json'[prints output in structured JSON format]' - ;; - (test) - _arguments \ - -v'[print output from test subprocess]' \ - -ldflags'["flag list" arguments to pass to the linker]' \ - -gcflags'["arg list" arguments to pass to the compiler]' \ - -race'[enable data race detection]' \ - -tags'["tag list" additional build tags]' - ;; - (vendor) - __gb-vendor - esac - ;; - esac - - return ret -} - -compdef _gb_commands gb - -__gb-vendor () -{ - local curcontext="$curcontext" state line - - _arguments -C ':command:->command' '*::options:->options' +_gb () { + local ret=1 state + _arguments -C ':command:->command' '*::options:->options' && ret=0 case $state in - (command) - - local -a subcommands - subcommands=( - 'delete:deletes a local dependency' - 'fetch:fetch a remote dependency' - 'list:lists dependencies, one per line' - 'purge:remove all unreferenced dependencies' - 'restore:restore dependencies from the manifest' - 'update:update a local dependency' - ) - _describe -t subcommands 'gb vendor subcommands' subcommands && ret=0 + (command) + local -a subcommands + subcommands=( + "build:build a package" + "doc:show documentation for a package or symbol" + "env:print project environment variables" + "generate:generate Go files by processing source" + "help:displays the help" + "info:info returns information about this project" + "list:list the packages named by the importpaths" + "test:test packages" + "vendor:manage your vendored dependencies" + ) + _describe -t subcommands 'gb subcommands' subcommands && ret=0 ;; + (options) + case $line[1] in + (build) + _arguments \ + -f'[ignore cached packages]' \ + -F'[do not cache packages]' \ + -q'[decreases verbosity]' \ + -P'[the number of build jobs to run in parallel]' \ + -R'[sets the base of the project root search path]' \ + -dotfile'[output a dot formatted file of the build steps]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (list) + _arguments \ + -f'[alternate format for the list, using the syntax of package template]' \ + -s'[read format template from STDIN]' \ + -json'[prints output in structured JSON format]' + ;; + (test) + _arguments \ + -v'[print output from test subprocess]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (vendor) + _gb-vendor + esac + ;; + esac - (options) - case $line[1] in - (delete) - _arguments \ - -all'[remove all dependencies]' - ;; - (fetch) - _arguments \ - -branch'[fetch from a particular branch]' \ - -no-recurse'[do not fetch recursively]' \ - -tag'[fetch the specified tag]' \ - -revision'[fetch the specific revision from the branch (if supplied)]' \ - -precaire'[allow the use of insecure protocols]' \ - ;; - (list) - _arguments \ - -f'[controls the template used for printing each manifest entry]' - ;; - (restore) - _arguments \ - -precaire'[allow the use of insecure protocols]' - ;; - (update) - _arguments \ - -all'[update all dependencies in the manifest or supply a given dependency]' \ - -precaire'[allow the use of insecure protocols]' - ;; - esac + return ret +} + +compdef _gb gb + +_gb-vendor () { + local curcontext="$curcontext" state line + _arguments -C ':command:->command' '*::options:->options' + + case $state in + (command) + local -a subcommands + subcommands=( + 'delete:deletes a local dependency' + 'fetch:fetch a remote dependency' + 'list:lists dependencies, one per line' + 'purge:remove all unreferenced dependencies' + 'restore:restore dependencies from the manifest' + 'update:update a local dependency' + ) + _describe -t subcommands 'gb vendor subcommands' subcommands && ret=0 + ;; + (options) + case $line[1] in + (delete) + _arguments \ + -all'[remove all dependencies]' + ;; + (fetch) + _arguments \ + -branch'[fetch from a particular branch]' \ + -no-recurse'[do not fetch recursively]' \ + -tag'[fetch the specified tag]' \ + -revision'[fetch the specific revision from the branch (if supplied)]' \ + -precaire'[allow the use of insecure protocols]' \ + ;; + (list) + _arguments \ + -f'[controls the template used for printing each manifest entry]' + ;; + (restore) + _arguments \ + -precaire'[allow the use of insecure protocols]' + ;; + (update) + _arguments \ + -all'[update all dependencies in the manifest or supply a given dependency]' \ + -precaire'[allow the use of insecure protocols]' + ;; + esac ;; esac } From cab6359173fb99c832617a5aa24ec734586ff055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 3 Jul 2016 23:27:33 +0200 Subject: [PATCH 09/10] Rename gb completion file to more conventional _gb --- plugins/getgb/{getgb.plugin.zsh => _gb} | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename plugins/getgb/{getgb.plugin.zsh => _gb} (99%) diff --git a/plugins/getgb/getgb.plugin.zsh b/plugins/getgb/_gb similarity index 99% rename from plugins/getgb/getgb.plugin.zsh rename to plugins/getgb/_gb index 726f0a24..8148adf1 100644 --- a/plugins/getgb/getgb.plugin.zsh +++ b/plugins/getgb/_gb @@ -1,3 +1,6 @@ +#compdef gb +#autoload + _gb () { local ret=1 state _arguments -C ':command:->command' '*::options:->options' && ret=0 @@ -56,8 +59,6 @@ _gb () { return ret } -compdef _gb gb - _gb-vendor () { local curcontext="$curcontext" state line _arguments -C ':command:->command' '*::options:->options' @@ -106,3 +107,5 @@ _gb-vendor () { ;; esac } + +_gb From dc0a884ea7b4298861cb081a4b76c9f0b42c7ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 3 Jul 2016 23:29:00 +0200 Subject: [PATCH 10/10] Rename getgb plugin to gb --- plugins/{getgb => gb}/README.md | 4 ++-- plugins/{getgb => gb}/_gb | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename plugins/{getgb => gb}/README.md (88%) rename plugins/{getgb => gb}/_gb (100%) diff --git a/plugins/getgb/README.md b/plugins/gb/README.md similarity index 88% rename from plugins/getgb/README.md rename to plugins/gb/README.md index 88881cb2..822c29aa 100644 --- a/plugins/getgb/README.md +++ b/plugins/gb/README.md @@ -9,9 +9,9 @@ See https://getgb.io for the full `gb` documentation - Adds completion support for all `gb` commands. - Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor). -To use it, add `getgb` to your plugins array: +To use it, add `gb` to your plugins array: ```sh -plugins=(... getgb) +plugins=(... gb) ``` ## Caveats diff --git a/plugins/getgb/_gb b/plugins/gb/_gb similarity index 100% rename from plugins/getgb/_gb rename to plugins/gb/_gb