Unverified Commit cad48e38 authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into fabric_task_description

parents 225425fe 40df67bc
......@@ -244,7 +244,7 @@ _history-substring-search-end() {
_history_substring_search_result=$BUFFER
# the search was succesful so display the result properly by clearing away
# the search was successful so display the result properly by clearing away
# existing highlights and moving the cursor to the end of the result buffer
if [[ $_history_substring_search_refresh_display -eq 1 ]]; then
region_highlight=()
......
# Homestead
This plugin provides completion for [Homestead](https://laravel.com/docs/homestead).
To use it add homestead to the plugins array in your zshrc file.
```bash
plugins=(... homestead)
```
# Homestead basic command completion
_homestead_get_command_list () {
homestead --no-ansi | sed -E "1,/(Available|Common) commands/d" | awk '/^ +[a-z]+/ { print $1 }'
}
_homestead () {
compadd `_homestead_get_command_list`
}
compdef _homestead homestead
## HTTPie
**Maintainer:** [lululau](https://github.com/lululau)
# HTTPie plugin
This plugin adds completion for [HTTPie](https://httpie.org), a command line HTTP
client, a friendlier cURL replacement.
To use it, add `httpie` to the plugins array in your zshrc file:
This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement.
```zsh
plugins=(... httpie)
```
[HTTPie Homepage](http://httpie.org)
It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions).
**Maintainer:** [lululau](https://github.com/lululau)
#compdef http
# ------------------------------------------------------------------------------
# Copyright (c) 2015 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 httpie 0.7.2 (http://httpie.org)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Akira Maeda <https://github.com/glidenote>
# * Valodim <https://github.com/Valodim>
# * Claus Klingberg <https://github.com/cjk>
#
# ------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------
_httpie_params () {
local ret=1 expl
# or a url
if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then
_httpie_urls && ret=0
# regular param, if we already have a url
elif (( CURRENT > NORMARG )); then
# if the suffix is precisely : this is shorthand for a header
if [[ -prefix ':' ]]; then
PREFIX=
SUFFIX=:
fi
# if we are in front of a : (possibly due to the PREFIX move before)
if [[ -suffix ':' ]]; then
# this is rather buggy with normal tab behavior :\
compstate[insert]=menu
_wanted http_header expl 'HTTP Header' \
compadd -s ':' -S '' -- Content-Type Cookie && return 0
fi
# ignore all prefix stuff
compset -P '(#b)([^:@=]#)'
local name=$match[1]
if compset -P '='; then
_message "$name data field value"
elif compset -P '@'; then
_files
elif compset -P ':=@'; then
_files
elif compset -P ':='; then
_message "$name raw json data"
elif compset -P '=='; then
_message "$name url parameter value"
elif compset -P ':'; then
_message "$name header content"
else
typeset -a ops
ops=(
'=:data field'
'\::header'
'==:request parameter'
'@:data file field'
'\:=:raw json field'
'\:=@:raw json field file path'
)
_describe -t httpparams "parameter types" ops -Q -S ''
fi
ret=0
fi
# first arg may be a request method
(( CURRENT == NORMARG )) &&
_wanted http_method expl 'Request Method' \
compadd GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT PATCH LINK UNLINK && ret=0
return $ret
}
_httpie_urls() {
local ret=1
if ! [[ -prefix [-+.a-z0-9]#:// ]]; then
local expl
compset -S '[^:/]*' && compstate[to_end]=''
_wanted url-schemas expl 'URL schema' compadd -S '' http:// https:// && ret=0
else
_urls && ret=0
fi
return $ret
}
_httpie_printflags () {
local ret=1
# not sure why this is necessary, but it will complete "-pH" style without it
[[ $IPREFIX == "-p" ]] && IPREFIX+=" "
compset -P '(#b)([a-zA-Z]#)'
local -a flags
[[ $match[1] != *H* ]] && flags+=( "H:request headers" )
[[ $match[1] != *B* ]] && flags+=( "B:request body" )
[[ $match[1] != *h* ]] && flags+=( "h:response headers" )
[[ $match[1] != *b* ]] && flags+=( "b:response body" )
_describe -t printflags "print flags" flags -S '' && ret=0
return $ret
}
integer NORMARG
_arguments -n -C -s \
'(-j --json -f)'{-j,--json}'[Data items from the command line are serialized as a JSON object.]' \
'(-f --form -j)'{-f,--form}'[Data items from the command line are serialized as form fields.]' \
'--pretty=[Controls output processing.]:output format:(all colors format none)' \
'(-s --style)'{-s,--style}'=[Output coloring style]:STYLE:(autumn borland bw colorful default emacs friendly fruity manni monokai murphy native pastie perldoc ttr solarized tango trac vim vs)' \
'(-p --print)'{-p,--print}'=[String specifying what the output should contain]:print flags:_httpie_printflags' \
'(-v --verbose)'{-v,--verbose}'[Print the whole request as well as the response.]' \
'(-p -h --headers)'{-h,--headers}'[Print only the response headers.]' \
'(-p -b --body)'{-b,--body}'[Print only the response body.]' \
'(-S --stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f`.]' \
'(-o --output)'{-o,--output}'=[Save output to FILE.]:output file:_files' \
'(-d --download)'{-d,--download}'=[Do not print the response body to stdout.]' \
'(-c --continue)'{-c,--continue}'[Resume an interrupted download.]' \
'(--session-read-only)--session=[Create, or reuse and update a session.]:session name (or path)' \
'(--session)--session-read-only=[Create or read a session without updating it form the request/response exchange.]:session name (or path)' \
'(-a --auth)'{-a,--auth}'=[If only the username is provided (-a username)]:USER\:PASS' \
'--auth-type=[The authentication mechanism to be used. Defaults to "basic".]:AUTH-TYPE:(basic digest)' \
'--proxy=[String mapping protocol to the URL of the proxy.]:PROXY' \
'--follow[Allow full redirects.]' \
"--verify=[Enable or disable verification of ssl certificates.]:verify certificate:(yes no)" \
'--allow-redirects[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new ``Location``)]' \
'--timeout=[Float describes the timeout of the request (Use socket.setdefaulttimeout() as fallback).]:timeout (seconds)' \
'--check-status[This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \
'--ignore-stdin[Do not attempt to read stdin.]' \
'(- *)--help[show help message.]' \
"(- *)--version[show program's version number and exit.]" \
'--traceback[Prints exception traceback should one occur.]' \
'--debug[Prints exception traceback should one occur and other information useful for debugging HTTPie itself.]' \
'*:args:_httpie_params' && return 0
function _httpie_completion() {
_arguments -C \
'(- 1 *)--version[display version information]' \
'(-j|--json)'{-j,--json}'[(default) Data items from the command line are serialized as a JSON object]' \
'(-f|--form)'{-f,--form}'[Data items from the command line are serialized as form fields]' \
'(--pretty)--pretty[<all,colors,format,none> Controls output processing]:options' \
'(-s|--style)'{-s,--style}'[Output coloring style]' \
'(-p|--print)'{-p,--print}'[String specifying what the output should contain: H(request headers), B(request body), h(response headers), b(response body)]' \
'(-v|--verbose)'{-v,--verbose}'[Print the whole request as well as the response. Shortcut for --print=HBbh.]' \
'(-h|--headers)'{-h,--headers}'[Print only the response headers. Shortcut for --print=h]' \
'(-b|--body)'{-b,--body}'[Print only the response body. Shortcut for --print=b]' \
'(-S|--stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f'"'"']' \
'(-o|--output)'{-o,--output}'[Save output to FILE]:file:_files' \
'(-d|--download)'{-d,--download}'[Do not print the response body to stdout. Rather, download it and store it in a file. The filename is guessed unless specified with --output filename. This action is similar to the default behaviour of wget.]' \
'(-c|--continue)'{-c,--continue}'[Resume an interrupted download. Note that the --output option needs to be specified as well.]' \
'(--session)--session[Create, or reuse and update a session. Within a session, custom headers, auth credential, as well as any cookies sent by the server persist between requests]:file:_files' \
'(--session-read-only)--session-read-only[Create or read a session without updating it form the request/response exchange]:file:_files' \
'(-a|--auth)'{-a,--auth}'[<USER:PASS> If only the username is provided (-a username), HTTPie will prompt for the password]' \
'(--auth-type)--auth-type[<basic, digest> The authentication mechanism to be used. Defaults to "basic".]' \
'(--proxy)--proxy[<PROTOCOL:PROXY_URL> String mapping protocol to the URL of the proxy]' \
'(--follow)--follow[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new Location).]' \
'(--verify)--verify[<VERIFY> Set to "no" to skip checking the host'"'"'s SSL certificate. You can also pass the path to a CA_BUNDLE file for private certs. You can also set the REQUESTS_CA_BUNDLE environment variable. Defaults to "yes".]' \
'(--timeout)--timeout[<SECONDS> The connection timeout of the request in seconds. The default value is 30 seconds]' \
'(--check-status)--check-status[By default, HTTPie exits with 0 when no network or other fatal errors occur. This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \
'(--ignore-stdin)--ignore-stdin[Do not attempt to read stdin]' \
'(--help)--help[Show this help message and exit]' \
'(--traceback)--traceback[Prints exception traceback should one occur]' \
'(--debug)--debug[Prints exception traceback should one occur, and also other information that is useful for debugging HTTPie itself and for reporting bugs]' \
'1: :->cmds' \
'*: :->args' && ret=0
}
compdef _httpie_completion http
\ No newline at end of file
# iTerm2 plugin
This plugin adds a few functions that are useful when using [iTerm2](https://www.iterm2.com/).
To use it, add _iterm2_ to the plugins array of your zshrc file:
```
plugins=(... iterm2)
```
## Plugin commands
* `_iterm2_command <iterm2-command>`
executes an arbitrary iTerm2 command via an escape code sequence.
See https://iterm2.com/documentation-escape-codes.html for all supported commands.
* `iterm2_profile <profile-name>`
changes the current terminal window's profile (colors, fonts, settings, etc).
`profile-name` is the name of another iTerm2 profile. The profile name can contain spaces.
* `iterm2_tab_color <red> <green> <blue>`
changes the color of iTerm2's currently active tab.
`red`/`green`/`blue` are on the range 0-255.
* `iterm2_tab_color_reset`
resets the color of iTerm2's current tab back to default.
## Contributors
- [Aviv Rosenberg](https://github.com/avivrosenberg)
#####################################################
# iTerm2 plugin for oh-my-zsh #
# Author: Aviv Rosenberg (github.com/avivrosenberg) #
#####################################################
###
# This plugin is only relevant if the terminal is iTerm2 on OSX.
if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then
###
# Executes an arbitrary iTerm2 command via an escape code sequce.
# See https://iterm2.com/documentation-escape-codes.html for all supported commands.
# Example: $ _iterm2_command "1337;StealFocus"
function _iterm2_command() {
local cmd="$1"
# Escape codes for wrapping commands for iTerm2.
local iterm2_prefix="\x1B]"
local iterm2_suffix="\x07"
# If we're in tmux, a special escape code must be prepended/appended so that
# the iTerm2 escape code is passed on into iTerm2.
if [[ -n $TMUX ]]; then
local tmux_prefix="\x1BPtmux;\x1B"
local tmux_suffix="\x1B\\"
fi
echo -n "${tmux_prefix}${iterm2_prefix}${cmd}${iterm2_suffix}${tmux_suffix}"
}
###
# iterm2_profile(): Function for changing the current terminal window's
# profile (colors, fonts, settings, etc).
# To change the current iTerm2 profile, call this function and pass in a name
# of another existing iTerm2 profile (name can contain spaces).
function iterm2_profile() {
# Desired name of profile
local profile="$1"
# iTerm2 command for changing profile
local cmd="1337;SetProfile=$profile"
# send the sequence
_iterm2_command "${cmd}"
# update shell variable
ITERM_PROFILE="$profile"
}
###
# iterm2_tab_color(): Changes the color of iTerm2's currently active tab.
# Usage: iterm2_tab_color <red> <green> <blue>
# where red/green/blue are on the range 0-255.
function iterm2_tab_color() {
_iterm2_command "6;1;bg;red;brightness;$1"
_iterm2_command "6;1;bg;green;brightness;$2"
_iterm2_command "6;1;bg;blue;brightness;$3"
}
###
# iterm2_tab_color_reset(): Resets the color of iTerm2's current tab back to
# default.
function iterm2_tab_color_reset() {
_iterm2_command "6;1;bg;*;default"
}
fi
# provide a whois command with a more accurate and up to date list of whois
# servers using CNAMES via whois.geek.nz
function iwhois() {
resolver="whois.geek.nz"
tld=`echo ${@: -1} | awk -F "." '{print $NF}'`
whois -h ${tld}.${resolver} "$@" ;
}
# Jake
This plugin provides completion for [Jake](http://jakejs.com/).
To use it add jake-node to the plugins array in your zshrc file.
```bash
plugins=(... jake-node)
```
......@@ -3,7 +3,7 @@
# Warning : Jakefile should have the right case : Jakefile or jakefile
# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10
# Author : Alexandre Lacheze (@al3xstrat)
# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh
# Inspiration : https://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh
function _jake () {
if [ -f Jakefile ]||[ -f jakefile ]; then
......@@ -11,4 +11,4 @@ function _jake () {
fi
}
compdef _jake jake
\ No newline at end of file
compdef _jake jake
# jenv plugin
[jenv](https://www.jenv.be/) is a Java version manager similiar to [rbenv](https://github.com/rbenv/rbenv)
and [pyenv](https://github.com/yyuu/pyenv).
This plugin initializes jenv and provides the `jenv_prompt_info` function to add Java
version information to prompts.
To use, add `jenv` to your plugins array in your zshrc file:
```zsh
plugins=(... jenv)
```
## Theme example
You can modify your `$PROMPT` or `$RPROMPT` variables to run `jenv_prompt_info`.
For example:
```
PROMPT="%~$ "
RPROMPT='$(jenv_prompt_info)'
```
changes your prompt to:
```
~/java/project$ ▋ oracle64-1.6.0.39
```
jenvdirs=("$HOME/.jenv" "/usr/local" "/usr/local/jenv" "/opt/jenv")
FOUND_JENV=0
for jenvdir in $jenvdirs; do
if [[ -d "${jenvdir}/bin" ]]; then
FOUND_JENV=1
break
fi
done
if [[ $FOUND_JENV -eq 0 ]]; then
if (( $+commands[brew] )) && jenvdir="$(brew --prefix jenv)"; then
[[ -d "${jenvdir}/bin" ]] && FOUND_JENV=1
fi
fi
if [[ $FOUND_JENV -eq 1 ]]; then
export PATH="${jenvdir}/bin:$PATH"
eval "$(jenv init - zsh)"
function jenv_prompt_info() { jenv version-name 2>/dev/null }
if [[ -d "${jenvdir}/versions" ]]; then
export JENV_ROOT=$jenvdir
fi
else
function jenv_prompt_info() { echo "system: $(java -version 2>&1 | cut -f 2 -d ' ')" }
fi
unset jenvdir jenvdirs FOUND_JENV
......@@ -21,6 +21,8 @@ jira new # opens a new issue
jira dashboard # opens your JIRA dashboard
jira reported [username] # queries for issues reported by a user
jira assigned [username] # queries for issues assigned to a user
jira myissues # queries for you own issues
jira branch # opens an existing issue matching the current branch name
jira ABC-123 # opens an existing issue
jira ABC-123 m # opens an existing issue for adding a comment
```
......
......@@ -7,6 +7,7 @@ _1st_arguments=(
'dashboard:open the dashboard'
'reported:search for issues reported by a user'
'assigned:search for issues assigned to a user'
'branch:open the issue named after the git branch of the current directory'
'dumpconfig:display effective jira configuration'
)
......
......@@ -2,13 +2,21 @@
#
# See README.md for details
: ${JIRA_DEFAULT_ACTION:=new}
function jira() {
emulate -L zsh
local action=${1:=$JIRA_DEFAULT_ACTION}
local action jira_url jira_prefix
if [[ -n "$1" ]]; then
action=$1
elif [[ -f .jira-default-action ]]; then
action=$(cat .jira-default-action)
elif [[ -f ~/.jira-default-action ]]; then
action=$(cat ~/.jira-default-action)
elif [[ -n "${JIRA_DEFAULT_ACTION}" ]]; then
action=${JIRA_DEFAULT_ACTION}
else
action="new"
fi
local jira_url jira_prefix
if [[ -f .jira-url ]]; then
jira_url=$(cat .jira-url)
elif [[ -f ~/.jira-url ]]; then
......@@ -35,7 +43,10 @@ function jira() {
echo "Opening new issue"
open_command "${jira_url}/secure/CreateIssue!default.jspa"
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
_jira_query $@
_jira_query ${@:-$action}
elif [[ "$action" == "myissues" ]]; then
echo "Opening my issues"
open_command "${jira_url}/issues/?filter=-1"
elif [[ "$action" == "dashboard" ]]; then
echo "Opening dashboard"
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
......@@ -51,8 +62,14 @@ function jira() {
echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION"
else
# Anything that doesn't match a special action is considered an issue name
local issue_arg=$action
local issue="${jira_prefix}${issue_arg}"
# but `branch` is a special case that will parse the current git branch
if [[ "$action" == "branch" ]]; then
local issue_arg=$(git rev-parse --abbrev-ref HEAD)
local issue="${jira_prefix}${issue_arg}"
else
local issue_arg=$action
local issue="${jira_prefix}${issue_arg}"
fi
local url_fragment=''
if [[ "$2" == "m" ]]; then
url_fragment="#add-comment"
......
# JRuby plugin
This plugin adds aliases for [JRuby](https://www.jruby.org/).
To use it, add `jruby` to the plugins array in your zshrc file:
```zsh
plugins=(... jruby)
```
## Requirements
This plugin assumes you already have jruby installed and available in your [path](https://www.jruby.org/getting-started).
## Aliases
| Alias | Command |
| ------------ | ---------------------------------------------------------------- |
| `jrspec` | `jruby --debug -S rspec --debug` |
| `jprofile` | `jruby --profile.api -S rspec` |
| `jexec` | `jruby -S` |
# Jump plugin
This plugin allows to easily jump around the file system by manually adding marks.
Those marks are stored as symbolic links in the directory `$MARKPATH` (default `$HOME/.marks`)
To use it, add `jump` to the plugins array in your zshrc file:
```zsh
plugins=(... jump)
```
## Commands
| Command | Description |
|----------------------|-------------------------------------------------------------------------------------------------|
| `jump <mark-name>` | Jump to the given mark |
| `mark [mark-name]` | Create a mark with the given name or with the name of the current directory if none is provided |
| `unmark <mark-name>` | Remove the given mark |
| `marks` | List the existing marks and the directories they point to |
......@@ -9,7 +9,7 @@
export MARKPATH=$HOME/.marks
jump() {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
cd -P "$MARKPATH/$1" 2>/dev/null || {echo "No such mark: $1"; return 1}
}
mark() {
......@@ -19,7 +19,7 @@ mark() {
MARK="$1"
fi
if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK"
mkdir -p "$MARKPATH"; ln -sfn "$PWD" "$MARKPATH/$MARK"
fi
}
......@@ -28,11 +28,18 @@ unmark() {
}
marks() {
local max=0
for link in $MARKPATH/*(@); do
if [[ ${#link:t} -gt $max ]]; then
max=${#link:t}
fi
done
local printf_markname_template="$(printf -- "%%%us " "$max")"
for link in $MARKPATH/*(@); do
local markname="$fg[cyan]${link:t}$reset_color"
local markpath="$fg[blue]$(readlink $link)$reset_color"
printf "%s\t" $markname
printf "-> %s \t\n" $markpath
printf -- "$printf_markname_template" "$markname"
printf -- "-> %s\n" "$markpath"
done
}
......
# Kate plugin
This plugin adds aliases for the [Kate editor](https://kate-editor.org).
To use it, add kate to the plugins array of your zshrc file:
```
plugins=(... kate)
```
## Aliases
| Alias | Command | Description |
|-------|------------------------|---------------------|
| kate | `kate >/dev/null 2>&1` | Start kate silently |
## Functions
| Function | Description |
|------------|------------------------------------------|
| `kt <dir>` | Change to directory and start kate there |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment