Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into personal
Browse files Browse the repository at this point in the history
* origin/master:
  Rename getgb plugin to gb
  Rename gb completion file to more conventional _gb
  Fix formatting of gb plugin completion
  Add more information to the README
  Add README to gb plugin
  Add plugin for Gb completion (http://getgb.io)
  bundler plugin: Simplify retrieval of cpu count on OSX (ohmyzsh#5180)
  Fix gfg function completion definition
  Fix man-preview completion definition
  Fix issue with `dash` as the default `/bin/sh` script executing program. (ohmyzsh#5177)
  znt: update to v2.2.1 (ohmyzsh#5174)
  emacs plugin tweak to open buffer from stdin (ohmyzsh#5126)
  Update taskwarrior completion to 2.5.1 (ohmyzsh#5171)
  Remove undesirable hardcoding of PATH into zshrc (ohmyzsh#4925)
  Add README for OSX plugin and refactor plugin file
  Open finder to PWD - part 2 (ohmyzsh#5165)
  Add ofd() to OSX plugin to open finder on current directory (ohmyzsh#5164)
  add 'mvn clean install -DskipTests --offline' alias to speed up maven compile (ohmyzsh#5153)
  Peepcode theme: Don't try to use RVM if it's not available (ohmyzsh#5154)
  Replace _kitchen completion with the version from zsh-users (ohmyzsh#5011)
  • Loading branch information
Hamish Downer committed Jul 14, 2016
2 parents 5c67950 + 644bc64 commit 93d7828
Show file tree
Hide file tree
Showing 20 changed files with 331 additions and 75 deletions.
2 changes: 1 addition & 1 deletion plugins/bundler/bundler.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 23 additions & 7 deletions plugins/emacs/emacsclient.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
#!/bin/sh

# get list of available X windows.
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
_emacsfun()
{
# get list of available X windows.
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`

if [ -z "$x" ] || [ "$x" = "nil" ] ;then
# Create one if there is no X window yet.
emacsclient --alternate-editor "" --create-frame "$@"
if [ -z "$x" ] || [ "$x" = "nil" ] ;then
# Create one if there is no X window yet.
emacsclient --alternate-editor "" --create-frame "$@"
else
# prevent creating another X frame if there is at least one present.
emacsclient --alternate-editor "" "$@"
fi
}


# 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" -a "$2" = "-" ]
then
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
cat - > "$tempfile"
_emacsfun --no-wait $tempfile
else
# prevent creating another X frame if there is at least one present.
emacsclient --alternate-editor "" "$@"
_emacsfun "$@"
fi
21 changes: 21 additions & 0 deletions plugins/gb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# `gb` plugin

> A project based build tool for the Go programming language.
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 `gb` to your plugins array:
```sh
plugins=(... gb)
```

## Caveats

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.
111 changes: 111 additions & 0 deletions plugins/gb/_gb
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#compdef gb
#autoload

_gb () {
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
}

_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
}

_gb
2 changes: 1 addition & 1 deletion plugins/git/git.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
110 changes: 77 additions & 33 deletions plugins/kitchen/_kitchen
Original file line number Diff line number Diff line change
@@ -1,41 +1,85 @@
# author: Peter Eisentraut
# source: https://gist.github.com/petere/10307599
# compdef kitchen
#compdef kitchen
# ------------------------------------------------------------------------------
# Copyright (c) 2014 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for Test Kitchen (http://kitchen.ci/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Peter Eisentraut (https://github.com/petere)
#
# ------------------------------------------------------------------------------


_kitchen() {
local curcontext="$curcontext" state line
typeset -A opt_args

_arguments '1: :->cmds'\
'2: :->args'

case $state in
cmds)
_arguments "1:Commands:(console converge create destroy diagnose driver help init list login setup test verify version)"
;;
args)
case $line[1] in
converge|create|destroy|diagnose|list|setup|test|verify)
compadd "$@" all
_kitchen_instances
;;
login)
_kitchen_instances
;;
esac
;;
esac
local curcontext="$curcontext" state line
typeset -A opt_args

_arguments '1: :->cmds'\
'2: :->args'

case $state in
cmds)
_kitchen_commands
;;
args)
case $line[1] in
converge|create|destroy|diagnose|list|setup|test|verify)
compadd 'all'
_kitchen_instances
;;
login)
_kitchen_instances
;;
esac
;;
esac
}

_kitchen_commands() {
local commands

commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ [].*# \(.*\)$/\1:\2/p')}")
_describe -t commands 'kitchen commands' commands
}

_kitchen_instances() {
if [[ $_kitchen_instances_cache_dir != $PWD ]]; then
unset _kitchen_instances_cache
fi
if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then
_kitchen_instances_cache=(${(f)"$(bundle exec kitchen list -b 2>/dev/null || kitchen list -b 2>/dev/null)"})
_kitchen_instances_cache_dir=$PWD
fi
compadd -a _kitchen_instances_cache
if [[ $_kitchen_instances_cache_dir != $PWD ]]; then
unset _kitchen_instances_cache
fi
if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then
_kitchen_instances_cache=(${(f)"$(_call_program instances $service list -b 2>/dev/null)"})
_kitchen_instances_cache_dir=$PWD
fi
_wanted instances expl 'instance' compadd -a _kitchen_instances_cache
}

_kitchen "$@"
1 change: 1 addition & 0 deletions plugins/mvn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ plugins=(... mvn)
| `mvncie` | `mvn clean install eclipse:eclipse` |
| `mvnci` | `mvn clean install` |
| `mvncist` | `mvn clean install -DskipTests` |
| `mvncisto` | `mvn clean install -DskipTests --offline` |
| `mvne` | `mvn eclipse:eclipse` |
| `mvnd` | `mvn deploy` |
| `mvnp` | `mvn package` |
Expand Down
1 change: 1 addition & 0 deletions plugins/mvn/mvn.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ mvn-color()
alias mvncie='mvn clean install eclipse:eclipse'
alias mvnci='mvn clean install'
alias mvncist='mvn clean install -DskipTests'
alias mvncisto='mvn clean install -DskipTests --offline'
alias mvne='mvn eclipse:eclipse'
alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
alias mvnd='mvn deploy'
Expand Down
27 changes: 27 additions & 0 deletions plugins/osx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# OSX plugin

## Description

This plugin provides a few utilities to make it more enjoyable on OSX.

To start using it, add the `osx` plugin to your plugins array in `~/.zshrc`:

```zsh
plugins=(... osx)
```

Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)


## Commands

| Command | Description |
|:--------------|:-----------------------------------------------|
| `tab` | Open the current directory in a new tab |
| `ofd` | Open the current directory in a Finder window |
| `pfd` | Return the path of the frontmost Finder window |
| `pfs` | Return the current Finder selection |
| `cdf` | `cd` to the current Finder directory |
| `pushdf` | `pushd` to the current Finder directory |
| `quick-look` | Quick-Look a specified file |
| `man-preview` | Open a specified man page in Preview app |
5 changes: 0 additions & 5 deletions plugins/osx/_man-preview

This file was deleted.

9 changes: 3 additions & 6 deletions plugins/osx/osx.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# ------------------------------------------------------------------------------
# FILE: osx.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
# VERSION: 1.1.0
# ------------------------------------------------------------------------------
# Open the current directory in a Finder window
alias ofd='open_command $PWD'

function _omz_osx_get_frontmost_app() {
local the_app=$(
Expand Down Expand Up @@ -179,6 +175,7 @@ function quick-look() {
function man-preview() {
man -t "$@" | open -f -a Preview
}
compdef _man man-preview

function vncviewer() {
open vnc://$@
Expand Down
Loading

0 comments on commit 93d7828

Please sign in to comment.