Commit 18ef1ee6 authored by Dawid Ferenczy's avatar Dawid Ferenczy
Browse files

Merge remote-tracking branch 'robbyrussell/master'

parents eafd5f32 192de6bc
......@@ -27,8 +27,6 @@ _1st_arguments=(
"config\:push":"push local config vars to heroku"
"config\:set":"set one or more config vars"
"config\:unset":"unset one or more config vars"
"db\:push":"push local data up to your app"
"db\:pull":"pull heroku data down into your local database"
"domains":"list custom domains for an app"
"domains\:add":"add a custom domain to an app"
"domains\:remove":"remove a custom domain from an app"
......@@ -43,12 +41,20 @@ _1st_arguments=(
"logs\:drains":"manage syslog drains"
"maintenance\:on":"put the app into maintenance mode"
"maintenance\:off":"take the app out of maintenance mode"
"pg\:credentials":"display the DATABASE credentials"
"pg\:diagnose":"run diagnostics report on DATABASE"
"pg\:info":"display database information"
"pg\:ingress":"allow direct connections to the database from this IP for one minute"
"pg\:kill":"kill a query"
"pg\:killall":"terminates ALL connections"
"pg\:maintenance":"manage maintenance for DATABASE"
"pg\:promote":"sets DATABASE as your DATABASE_URL"
"pg\:ps":"view active queries with execution time"
"pg\:psql":"open a psql shell to the database"
"pg\:pull":"pull from REMOTE_SOURCE_DATABASE to LOCAL_TARGET_DATABASE"
"pg\:push":"push from LOCAL_SOURCE_DATABASE to REMOTE_TARGET_DATABASE"
"pg\:reset":"delete all data in DATABASE"
"pg\:unfollow":"stop a replica from following and make it a read/write database"
"pg\:upgrade":"unfollow a database and upgrade it to the latest PostgreSQL version"
"pg\:wait":"monitor database creation, exit when complete"
"pgbackups":"list captured backups"
"pgbackups\:url":"get a temporary URL for a backup"
......@@ -108,26 +114,6 @@ case "$words[1]" in
'(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \
)
;;
db:push)
_command_args=(
'(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
'(-d|--debug)'{-d,--debug}'[enable debugging output]' \
'(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the push]' \
'(-f|--filter)'{-f,--filter}'[only push certain tables]' \
'(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
'(-t|--tables)'{-t,--tables}'[only push the specified tables]' \
)
;;
db:pull)
_command_args=(
'(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
'(-d|--debug)'{-d,--debug}'[enable debugging output]' \
'(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the pull]' \
'(-f|--filter)'{-f,--filter}'[only pull certain tables]' \
'(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
'(-t|--tables)'{-t,--tables}'[only pull the specified tables]' \
)
;;
keys)
_command_args=(
'(-l|--long)'{-l,--long}'[display extended information for each key]' \
......
To activate this script, load it into an interactive ZSH session:
% source history-substring-search.zsh
See the "history-substring-search.zsh" file for more information:
% sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more
To activate this script, please include it the `plugins` variable within `~/.zshrc`
`plugins=(git history-substring-search)`
See the "history-substring-search.zsh" file for more information:
`sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more`
......@@ -175,7 +175,6 @@ fi
# implementation details
#-----------------------------------------------------------------------------
setopt extendedglob
zmodload -F zsh/parameter
#
......@@ -284,6 +283,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
fi
function _history-substring-search-begin() {
setopt localoptions extendedglob
_history_substring_search_move_cursor_eol=false
_history_substring_search_query_highlight=
......@@ -350,6 +350,7 @@ function _history-substring-search-begin() {
}
function _history-substring-search-end() {
setopt localoptions extendedglob
_history_substring_search_result=$BUFFER
# move the cursor to the end of the command line
......
## history
Provides a couple of convenient aliases for using the `history` command to examine your command line history.
### Requirements
* None.
### Usage
* If `h` is called, your command history is listed. Equivalent to using `history`
* If `hsi` is called with an argument, a **case insensitive** `grep` search is performed on your command history, looking for commands that match the argument provided
* If `hsi` is called without an argument you will help on `grep` arguments
\ No newline at end of file
## HTTPie
**Maintainer:** [lululau](https://github.com/lululau)
This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement.
[HTTPie Homepage](http://httpie.org)
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
## JHBuild
**Maintainer:** [Miguel Vaello](https://github.com/miguxbe)
This plugin adds some jhbuild aliases and increase the completion function provided by zsh.
# Aliases
#
alias jh='jhbuild'
# Build
alias jhb='jhbuild build'
alias jhbo='jhbuild buildone'
# Checks
alias jhckb='jhbuild checkbranches'
alias jhckm='jhbuild checkmodulesets'
# Info & list
alias jhi='jhbuild info'
alias jhl='jhbuild list'
# Clean
alias jhc='jhbuild clean'
alias jhco='jhbuild cleanone'
# Run
alias jhr='jhbuild run'
# Depends
alias jhrd='jhbuild rdepends'
alias jhsd='jhbuild sysdeps'
# Update
alias jhu='jhbuild update'
alias jhuo='jhbuild updateone'
# Uninstall
alias jhun='jhbuild uninstall'
......@@ -11,13 +11,6 @@
# Usage: jira # opens a new issue
# jira ABC-123 # Opens an existing issue
open_jira_issue () {
local open_cmd
if [[ $(uname -s) == 'Darwin' ]]; then
open_cmd='open'
else
open_cmd='xdg-open'
fi
if [ -f .jira-url ]; then
jira_url=$(cat .jira-url)
elif [ -f ~/.jira-url ]; then
......@@ -26,20 +19,72 @@ open_jira_issue () {
jira_url=$JIRA_URL
else
echo "JIRA url is not specified anywhere."
return 0
return 1
fi
if [ -f .jira-prefix ]; then
jira_prefix=$(cat .jira-prefix)
elif [ -f ~/.jira-prefix ]; then
jira_prefix=$(cat ~/.jira-prefix)
else
jira_prefix=""
fi
if [ -z "$1" ]; then
echo "Opening new issue"
$open_cmd "$jira_url/secure/CreateIssue!default.jspa"
open_command "${jira_url}/secure/CreateIssue!default.jspa"
elif [[ "$1" = "assigned" || "$1" = "reported" ]]; then
jira_query $@
else
local addcomment=''
if [[ "$2" == "m" ]]; then
addcomment="#add-comment"
echo "Add comment to issue #$1"
else
echo "Opening issue #$1"
fi
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
$open_cmd "$jira_url/issues/$1"
open_command "$jira_url/issues/$jira_prefix$1$addcomment"
else
$open_cmd "$jira_url/browse/$1"
open_command "$jira_url/browse/$jira_prefix$1$addcomment"
fi
fi
}
jira_name () {
if [[ -z "$1" ]]; then
if [[ "x${JIRA_NAME}" != "x" ]]; then
jira_name=${JIRA_NAME}
else
echo "JIRA_NAME not specified"
return 1
fi
else
jira_name=$@
fi
}
jira_query () {
verb="$1"
if [[ "${verb}" = "reported" ]]; then
lookup=reporter
preposition=by
elif [[ "${verb}" = "assigned" ]]; then
lookup=assignee
preposition=to
else
echo "not a valid lookup $verb"
return 1
fi
shift 1
jira_name $@
if [[ $? = 1 ]]; then
return 1
fi
echo "Browsing issues ${verb} ${preposition} ${jira_name}"
open_command "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
}
alias jira='open_jira_issue'
File mode changed from 100755 to 100644
......@@ -13,13 +13,13 @@ jump() {
}
mark() {
if (( $# == 0 )); then
MARK=$(basename "$(pwd)")
if [[ ( $# == 0 ) || ( "$1" == "." ) ]]; then
MARK=$(basename "$PWD")
else
MARK="$1"
fi
if read -q \?"Mark $(pwd) as ${MARK}? (y/n) "; then
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$MARK"
if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK"
fi
}
......@@ -27,7 +27,6 @@ unmark() {
rm -i "$MARKPATH/$1"
}
autoload colors
marks() {
for link in $MARKPATH/*(@); do
local markname="$fg[cyan]${link:t}$reset_color"
......@@ -39,7 +38,7 @@ marks() {
_completemarks() {
if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then
reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g'))
reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_a-zA-Z0-9\.\-]*):$/\2/g'))
else
if readlink -e "${MARKPATH}"/* &>/dev/null; then
reply=($(ls "${MARKPATH}"))
......
# author: Peter Eisentraut
# source: https://gist.github.com/petere/10307599
# compdef kitchen
_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
}
_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
}
_kitchen "$@"
# Laravel4 basic command completion
_laravel4_get_command_list () {
php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }'
}
_laravel4 () {
......
# Laravel5 basic command completion
_laravel5_get_command_list () {
php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }'
}
_laravel5 () {
if [ -f artisan ]; then
compadd `_laravel5_get_command_list`
fi
}
compdef _laravel5 artisan
compdef _laravel5 la5
#Alias
alias la5='php artisan'
alias la5cache='php artisan cache:clear'
alias la5routes='php artisan route:list'
alias la5vendor='php artisan vendor:publish'
......@@ -4,18 +4,19 @@
# Flag indicating if we've previously jumped to last directory.
typeset -g ZSH_LAST_WORKING_DIRECTORY
mkdir -p "$ZSH/cache"
local cache_file="$ZSH/cache/last-working-dir"
mkdir -p $ZSH_CACHE_DIR
cache_file="$ZSH_CACHE_DIR/last-working-dir"
# Updates the last directory once directory is changed.
function chpwd() {
chpwd_functions+=(chpwd_last_working_dir)
function chpwd_last_working_dir() {
# Use >| in case noclobber is set to avoid "file exists" error
pwd >| "$cache_file"
}
# Changes directory to the last working directory.
function lwd() {
[[ ! -r "$cache_file" ]] || cd `cat "$cache_file"`
[[ ! -r "$cache_file" ]] || cd "`cat "$cache_file"`"
}
# Automatically jump to last working directory unless this isn't the first time
......
......@@ -9,7 +9,7 @@ open_lighthouse_ticket () {
else
lighthouse_url=$(cat .lighthouse-url);
echo "Opening ticket #$1";
`open $lighthouse_url/tickets/$1`;
open_command "$lighthouse_url/tickets/$1";
fi
}
......
## marked2
Plugin for Marked 2, a previewer for Markdown files on Mac OS X
### Requirements
* [Marked 2](http://marked2app.com)
### Usage
* If `marked` is called without an argument, open Marked
* If `marked` is passed a file, open it in Marked
#
# If marked is called without an argument, open Marked
# If marked is passed a file, open it in Marked
#
function marked() {
if [ "$1" ]
then
open -a "marked 2.app" "$1"
else
open -a "marked 2.app"
fi
}
# Mercurial plugin
### Usage
Update .zshrc:
1. Add name to the list of plugins, e.g. `plugins = (..., mercurial, ...)`
(that is pretty obvious).
2. Change PROMPT variable of current theme to contain current folder mercurial repo info:
robbyrussel theme is used by default, so you need to modify PROMPT var
from [this file](https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/robbyrussell.zsh-theme)
by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so currently it
looks next:
```diff
- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
```
and put modified var at the end of **.zshrc**.
3. Initialize additional vars used in plugin. So in short put next in **.zshrc**:
```
ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}"
ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})"
```
### What's inside?
#### Adds handy aliases:
###### general
* `hgc` - `hg commit`
* `hgb` - `hg branch`
* `hgba` - `hg branches`
* `hgbk` - `hg bookmarks`
* `hgco` - `hg checkout`
* `hgd` - `hg diff`
* `hged` - `hg diffmerge`
###### pull and update
* `hgi` - `hg incoming`
* `hgl` - `hg pull -u`
* `hglr` - `hg pull --rebase`
* `hgo` - `hg outgoing`
* `hgp` - `hg push`
* `hgs` - `hg status`
* `hgsl` - `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"`
###### this is the 'git commit --amend' equivalent
* `hgca` - `hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip`
###### list unresolved files (since hg does not list unmerged files in the status command)
* `hgun` - `hg resolve --list`
#### Displays repo branch and directory status in prompt
This is the same as git plugin does.
**Note**: additional changes to **.zshrc** are required in order for this to
work.
### Mantainers
[ptrv](https://github.com/ptrv) - original creator
[oshybystyi](https://github.com/oshybystyi) - created this README and know how most of code works
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