Unverified Commit 8c95c523 authored by Kozlov Alexander's avatar Kozlov Alexander Committed by GitHub
Browse files

Merge branch 'master' into master

parents dd30cf10 3d8f2bda
#!zsh
#
# Installation
# ------------
#
# To achieve git-hubflow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest version.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
#
# a. Place it in your .zshrc:
#
# b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-hubflow-completion.zsh
#
# c. Or, use this file as an oh-my-zsh plugin.
#
alias ghf='git hf' alias ghf='git hf'
alias ghff='git hf feature' alias ghff='git hf feature'
alias ghfr='git hf release' alias ghfr='git hf release'
......
# ZSH Git Prompt Plugin from: # ZSH Git Prompt Plugin from:
# http://github.com/olivierverdier/zsh-git-prompt # https://github.com/olivierverdier/zsh-git-prompt
__GIT_PROMPT_DIR="${0:A:h}" __GIT_PROMPT_DIR="${0:A:h}"
......
...@@ -22,7 +22,7 @@ def get_tagname_or_hash(): ...@@ -22,7 +22,7 @@ def get_tagname_or_hash():
tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1] tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
if tagname: if tagname:
return tagname return tagname.replace(' ', '')
elif hash_: elif hash_:
return hash_ return hash_
return None return None
...@@ -41,7 +41,7 @@ ahead, behind = 0, 0 ...@@ -41,7 +41,7 @@ ahead, behind = 0, 0
status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
for st in status: for st in status:
if st[0] == '#' and st[1] == '#': if st[0] == '#' and st[1] == '#':
if re.search('Initial commit on', st[2]): if re.search('Initial commit on', st[2]) or re.search('No commits yet on', st[2]):
branch = st[2].split(' ')[-1] branch = st[2].split(' ')[-1]
elif re.search('no branch', st[2]): # detached status elif re.search('no branch', st[2]): # detached status
branch = get_tagname_or_hash() branch = get_tagname_or_hash()
......
...@@ -44,12 +44,14 @@ alias ga='git add' ...@@ -44,12 +44,14 @@ alias ga='git add'
alias gaa='git add --all' alias gaa='git add --all'
alias gapa='git add --patch' alias gapa='git add --patch'
alias gau='git add --update' alias gau='git add --update'
alias gav='git add --verbose'
alias gap='git apply' alias gap='git apply'
alias gb='git branch' alias gb='git branch'
alias gba='git branch -a' alias gba='git branch -a'
alias gbd='git branch -d' alias gbd='git branch -d'
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbD='git branch -D'
alias gbl='git blame -b -w' alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged' alias gbnm='git branch --no-merged'
alias gbr='git branch --remote' alias gbr='git branch --remote'
...@@ -70,7 +72,7 @@ alias gcam='git commit -a -m' ...@@ -70,7 +72,7 @@ alias gcam='git commit -a -m'
alias gcsm='git commit -s -m' alias gcsm='git commit -s -m'
alias gcb='git checkout -b' alias gcb='git checkout -b'
alias gcf='git config --list' alias gcf='git config --list'
alias gcl='git clone --recursive' alias gcl='git clone --recurse-submodules'
alias gclean='git clean -fd' alias gclean='git clean -fd'
alias gpristine='git reset --hard && git clean -dfx' alias gpristine='git reset --hard && git clean -dfx'
alias gcm='git checkout master' alias gcm='git checkout master'
...@@ -88,6 +90,7 @@ alias gd='git diff' ...@@ -88,6 +90,7 @@ alias gd='git diff'
alias gdca='git diff --cached' alias gdca='git diff --cached'
alias gdcw='git diff --cached --word-diff' alias gdcw='git diff --cached --word-diff'
alias gdct='git describe --tags `git rev-list --tags --max-count=1`' alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdw='git diff --word-diff' alias gdw='git diff --word-diff'
...@@ -180,8 +183,11 @@ alias glgg='git log --graph' ...@@ -180,8 +183,11 @@ alias glgg='git log --graph'
alias glgga='git log --graph --decorate --all' alias glgga='git log --graph --decorate --all'
alias glgm='git log --graph --max-count=10' alias glgm='git log --graph --max-count=10'
alias glo='git log --oneline --decorate' alias glo='git log --oneline --decorate'
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" alias glols="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat"
alias glod="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"
alias glods="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all"
alias glog='git log --oneline --decorate --graph' alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all' alias gloga='git log --oneline --decorate --graph --all'
alias glp="_git_log_prettily" alias glp="_git_log_prettily"
...@@ -196,6 +202,8 @@ alias gma='git merge --abort' ...@@ -196,6 +202,8 @@ alias gma='git merge --abort'
alias gp='git push' alias gp='git push'
alias gpd='git push --dry-run' alias gpd='git push --dry-run'
alias gpf='git push --force-with-lease'
alias gpf!='git push --force'
alias gpoat='git push origin --all && git push origin --tags' alias gpoat='git push origin --all && git push origin --tags'
compdef _git gpoat=git-push compdef _git gpoat=git-push
alias gpu='git push upstream' alias gpu='git push upstream'
...@@ -206,11 +214,14 @@ alias gra='git remote add' ...@@ -206,11 +214,14 @@ alias gra='git remote add'
alias grb='git rebase' alias grb='git rebase'
alias grba='git rebase --abort' alias grba='git rebase --abort'
alias grbc='git rebase --continue' alias grbc='git rebase --continue'
alias grbd='git rebase develop'
alias grbi='git rebase -i' alias grbi='git rebase -i'
alias grbm='git rebase master' alias grbm='git rebase master'
alias grbs='git rebase --skip' alias grbs='git rebase --skip'
alias grh='git reset HEAD' alias grh='git reset'
alias grhh='git reset HEAD --hard' alias grhh='git reset --hard'
alias grm='git rm'
alias grmc='git rm --cached'
alias grmv='git remote rename' alias grmv='git remote rename'
alias grrm='git remote remove' alias grrm='git remote remove'
alias grset='git remote set-url' alias grset='git remote set-url'
...@@ -221,6 +232,7 @@ alias grv='git remote -v' ...@@ -221,6 +232,7 @@ alias grv='git remote -v'
alias gsb='git status -sb' alias gsb='git status -sb'
alias gsd='git svn dcommit' alias gsd='git svn dcommit'
alias gsh='git show'
alias gsi='git submodule init' alias gsi='git submodule init'
alias gsps='git show --pretty=short --show-signature' alias gsps='git show --pretty=short --show-signature'
alias gsr='git svn rebase' alias gsr='git svn rebase'
...@@ -233,6 +245,7 @@ alias gstd='git stash drop' ...@@ -233,6 +245,7 @@ alias gstd='git stash drop'
alias gstl='git stash list' alias gstl='git stash list'
alias gstp='git stash pop' alias gstp='git stash pop'
alias gsts='git stash show --text' alias gsts='git stash show --text'
alias gstall='git stash --all'
alias gsu='git submodule update' alias gsu='git submodule update'
alias gts='git tag -s' alias gts='git tag -s'
...@@ -242,6 +255,8 @@ alias gunignore='git update-index --no-assume-unchanged' ...@@ -242,6 +255,8 @@ alias gunignore='git update-index --no-assume-unchanged'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
alias gup='git pull --rebase' alias gup='git pull --rebase'
alias gupv='git pull --rebase -v' alias gupv='git pull --rebase -v'
alias gupa='git pull --rebase --autostash'
alias gupav='git pull --rebase --autostash -v'
alias glum='git pull upstream master' alias glum='git pull upstream master'
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
......
# Gitfast plugin
This plugin adds completion for Git, using the zsh completion from git.git folks, which is much faster than the official one from zsh. A lot of zsh-specific features are not supported, like descriptions for every argument, but everything the bash completion has, this one does too (as it is using it behind the scenes). Not only is it faster, it should be more robust, and updated regularly to the latest git upstream version..
To use it, add `gitfast` to the plugins array in your zshrc file:
```zsh
plugins=(... gitfast)
```
## Aliases
| Alias | Command |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| g | `git` |
| ga | `git add` |
| gaa | `git add --all` |
| gapa | `git add --patch` |
| gau | `git add --update` |
| gb | `git branch` |
| gba | `git branch -a` |
| gbd | `git branch -d` |
| gbda | `git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d` |
| gbl | `git blame -b -w` |
| gbnm | `git branch --no-merged` |
| gbr | `git branch --remote` |
| gbs | `git bisect` |
| gbsb | `git bisect bad` |
| gbsg | `git bisect good` |
| gbsr | `git bisect reset` |
| gbss | `git bisect start` |
| gc | `git commit -v` |
| gc! | `git commit -v --amend` |
| gca | `git commit -v -a` |
| gca! | `git commit -v -a --amend` |
| gcam | `git commit -a -m` |
| gcan! | `git commit -v -a --no-edit --amend` |
| gcans! | `git commit -v -a -s --no-edit --amend` |
| gcb | `git checkout -b` |
| gcd | `git checkout develop` |
| gcf | `git config --list` |
| gcl | `git clone --recursive` |
| gclean | `git clean -fd` |
| gcm | `git checkout master` |
| gcmsg | `git commit -m` |
| gcn! | `git commit -v --no-edit --amend` |
| gco | `git checkout` |
| gcount | `git shortlog -sn` |
| gcp | `git cherry-pick` |
| gcpa | `git cherry-pick --abort` |
| gcpc | `git cherry-pick --continue` |
| gcs | `git commit -S` |
| gcsm | `git commit -s -m` |
| gd | `git diff` |
| gdca | `git diff --cached` |
| gdct | `` git describe --tags `git rev-list --tags --max-count=1` `` |
| gdt | `git diff-tree --no-commit-id --name-only -r` |
| gdw | `git diff --word-diff` |
| gf | `git fetch` |
| gfa | `git fetch --all --prune` |
| gfo | `git fetch origin` |
| gg | `git gui citool` |
| gga | `git gui citool --amend` |
| ggpull | `git pull origin $(git_current_branch)` |
| ggpur | `ggu` |
| ggpush | `git push origin $(git_current_branch)` |
| ggsup | `git branch --set-upstream-to=origin/$(git_current_branch)` |
| ghh | `git help` |
| gignore | `git update-index --assume-unchanged` |
| gignored | `git ls-files -v | grep "^[[:lower:]]"` |
| git-svn-dcommit-push | `git svn dcommit && git push github master:svntrunk` |
| gk | `\gitk --all --branches` |
| gke | `\gitk --all $(git log -g --pretty=%h)` |
| gl | `git pull` |
| glg | `git log --stat` |
| glgg | `git log --graph` |
| glgga | `git log --graph --decorate --all` |
| glgm | `git log --graph --max-count=10` |
| glgp | `git log --stat -p` |
| glo | `git log --oneline --decorate` |
| glog | `git log --oneline --decorate --graph` |
| gloga | `git log --oneline --decorate --graph --all` |
| glol | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit` |
| glola | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --all` |
| glp | `_git_log_prettily` |
| glum | `git pull upstream master` |
| gm | `git merge` |
| gmom | `git merge origin/master` |
| gmt | `git mergetool --no-prompt` |
| gmtvim | `git mergetool --no-prompt --tool=vimdiff` |
| gmum | `git merge upstream/master` |
| gp | `git push` |
| gpd | `git push --dry-run` |
| gpoat | `git push origin --all && git push origin --tags` |
| gpristine | `git reset --hard && git clean -dfx` |
| gpsup | `git push --set-upstream origin $(git_current_branch)` |
| gpu | `git push upstream` |
| gpv | `git push -v` |
| gr | `git remote` |
| gra | `git remote add` |
| grb | `git rebase` |
| grba | `git rebase --abort` |
| grbc | `git rebase --continue` |
| grbi | `git rebase -i` |
| grbm | `git rebase master` |
| grbs | `git rebase --skip` |
| grh | `git reset HEAD` |
| grhh | `git reset HEAD --hard` |
| grmv | `git remote rename` |
| grrm | `git remote remove` |
| grset | `git remote set-url` |
| grt | `cd $(git rev-parse --show-toplevel || echo ".")` |
| gru | `git reset --` |
| grup | `git remote update` |
| grv | `git remote -v` |
| gsb | `git status -sb` |
| gsd | `git svn dcommit` |
| gsi | `git submodule init` |
| gsps | `git show --pretty=short --show-signature` |
| gsr | `git svn rebase` |
| gss | `git status -s` |
| gst | `git status` |
| gsta | `git stash save` |
| gstaa | `git stash apply` |
| gstc | `git stash clear` |
| gstd | `git stash drop` |
| gstl | `git stash list` |
| gstp | `git stash pop` |
| gsts | `git stash show --text` |
| gsu | `git submodule update` |
| gts | `git tag -s` |
| gtv | `git tag | sort -V` |
| gunignore | `git update-index --no-assume-unchanged` |
| gunwip | `git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1` |
| gup | `git pull --rebase` |
| gupv | `git pull --rebase -v` |
| gwch | `git whatchanged -p --abbrev-commit --pretty=medium` |
| gwip | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"` |
...@@ -11,14 +11,14 @@ This plugin supports working with GitHub from the command line. It provides a fe ...@@ -11,14 +11,14 @@ This plugin supports working with GitHub from the command line. It provides a fe
* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub * `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub
* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub * `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
* `exist_gh` - Takes an existing repo and pushes it to GitHub * `exist_gh` - Takes an existing repo and pushes it to GitHub
* `git.io` - Shortens a URL using [git.io](http://git.io) * `git.io` - Shortens a URL using [git.io](https://git.io)
## Installation ## Installation
[Hub](http://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ. [Hub](https://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ.
The [`github` Ruby gem](http://github.com/defunkt/github-gem) needs to be installed if you want to use it. The [`github` Ruby gem](https://github.com/defunkt/github-gem) needs to be installed if you want to use it.
### Configuration ### Configuration
......
...@@ -89,6 +89,7 @@ __hub_setup_zsh_fns () { ...@@ -89,6 +89,7 @@ __hub_setup_zsh_fns () {
browse:'browse the project on GitHub' browse:'browse the project on GitHub'
compare:'open GitHub compare view' compare:'open GitHub compare view'
ci-status:'lookup commit in GitHub Status API' ci-status:'lookup commit in GitHub Status API'
sync:'update local branches from upstream'
) )
_describe -t hub-commands 'hub command' hub_commands && ret=0 _describe -t hub-commands 'hub command' hub_commands && ret=0
...@@ -115,6 +116,7 @@ create ...@@ -115,6 +116,7 @@ create
browse browse
compare compare
ci-status ci-status
sync
EOF EOF
__git_list_all_commands_without_hub __git_list_all_commands_without_hub
} }
......
# Set up hub wrapper for git, if it is available; http://github.com/github/hub # Set up hub wrapper for git, if it is available; https://github.com/github/hub
if [ "$commands[(I)hub]" ]; then if (( $+commands[hub] )); then
if hub --version &>/dev/null; then alias git=hub
eval $(hub alias -s zsh)
fi
fi fi
# Functions ################################################################# # Functions #################################################################
...@@ -38,7 +36,7 @@ new_gh() { # [DIRECTORY] ...@@ -38,7 +36,7 @@ new_gh() { # [DIRECTORY]
print '.*'"\n"'*~' >> .gitignore print '.*'"\n"'*~' >> .gitignore
git add [^.]* \ git add [^.]* \
|| return || return
git add .gitignore \ git add -f .gitignore \
|| return || return
git commit -m 'Initial commit.' \ git commit -m 'Initial commit.' \
|| return || return
...@@ -65,7 +63,7 @@ exist_gh() { # [DIRECTORY] ...@@ -65,7 +63,7 @@ exist_gh() { # [DIRECTORY]
# git.io "GitHub URL" # git.io "GitHub URL"
# #
# Shorten GitHub url, example: # Shorten GitHub url, example:
# https://github.com/nvogel/dotzsh > http://git.io/8nU25w # https://github.com/nvogel/dotzsh > https://git.io/8nU25w
# source: https://github.com/nvogel/dotzsh # source: https://github.com/nvogel/dotzsh
# documentation: https://github.com/blog/985-git-io-github-url-shortener # documentation: https://github.com/blog/985-git-io-github-url-shortener
# #
......
# gitignore
This plugin enables you the use of [gitignore.io](https://www.gitignore.io/) from the command line. You need an active internet connection.
To use it, add `gitignore` to the plugins array in your zshrc file:
```zsh
plugins=(... gitignore)
```
## Plugin commands
* `gi list`: List all the currently supported gitignore.io templates.
* `gi [TEMPLATENAME]`: Show git-ignore output on the command line, e.g. `gi java` to exclude class and package files.
* `gi [TEMPLATENAME] >> .gitignore`: Appending programming language settings to your projects .gitignore.
function gi() { curl -sL https://www.gitignore.io/api/${(j:,:)@} } function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} }
_gitignoreio_get_command_list() { _gitignoreio_get_command_list() {
curl -sL https://www.gitignore.io/api/list | tr "," "\n" curl -sfL https://www.gitignore.io/api/list | tr "," "\n"
} }
_gitignoreio () { _gitignoreio () {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Expands all glob expressions, subcommands and aliases (including global). Expands all glob expressions, subcommands and aliases (including global).
Idea from: http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html. Idea from: https://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html.
## Usage ## Usage
......
The go plugin is deprecated. Use the [golang plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/golang) instead.
# Golang plugin
This plugin adds completion for the [Go Programming Language](https://golang.org/),
as well as some aliases for common Golang commands.
To use it, add `golang` to the plugins array in your zshrc file:
```zsh
plugins=(... golang)
```
## Aliases
| Alias | Command | Description |
| ------- | ----------------------- | ------------------------------------------------------------- |
| gob | `go build` | Build your code |
| goc | `go clean` | Removes object files from package source directories |
| god | `go doc` | Prints documentation comments |
| gof | `go fmt` | Gofmt formats (aligns and indents) Go programs. |
| gofa | `go fmt ./...` | Run go fmt for all packages in current directory, recursively |
| gog | `go get` | Downloads packages and then installs them to $GOPATH |
| goi | `go install` | Compiles and installs packages to $GOPATH |
| gol | `go list` | Lists Go packages |
| gop | `cd $GOPATH` | Takes you to $GOPATH |
| gopb | `cd $GOPATH/bin` | Takes you to $GOPATH/bin |
| gops | `cd $GOPATH/src` | Takes you to $GOPATH/src |
| gor | `go run` | Compiles and runs your code |
| got | `go test` | Runs tests |
| gov | `go vet` | Vet examines Go source code and reports suspicious constructs |
...@@ -135,7 +135,7 @@ __go_tool_complete() { ...@@ -135,7 +135,7 @@ __go_tool_complete() {
run) run)
_arguments -s -w : \ _arguments -s -w : \
${build_flags[@]} \ ${build_flags[@]} \
'*:file:_path_files -g "*.go"' '*:file:_files -g "*.go"'
;; ;;
tool) tool)
if (( CURRENT == 3 )); then if (( CURRENT == 3 )); then
...@@ -184,10 +184,13 @@ alias gob='go build' ...@@ -184,10 +184,13 @@ alias gob='go build'
alias goc='go clean' alias goc='go clean'
alias god='go doc' alias god='go doc'
alias gof='go fmt' alias gof='go fmt'
alias gofa='go fmt . ./...' alias gofa='go fmt ./...'
alias gog='go get' alias gog='go get'
alias goi='go install' alias goi='go install'
alias gol='go list' alias gol='go list'
alias gop='cd $GOPATH'
alias gopb='cd $GOPATH/bin'
alias gops='cd $GOPATH/src'
alias gor='go run' alias gor='go run'
alias got='go test' alias got='go test'
alias gov='go vet' alias gov='go vet'
# gpg-agent
Enables [GPG's gpg-agent](https://www.gnupg.org/documentation/manuals/gnupg/) if it is not running.
To use it, add gpg-agent to the plugins array of your zshrc file:
```
plugins=(... gpg-agent)
```
# Enable gpg-agent if it is not running # Enable gpg-agent if it is not running-
GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh" # --use-standard-socket will work from version 2 upwards
if [ ! -S $GPG_AGENT_SOCKET ]; then
gpg-agent --daemon >/dev/null 2>&1 AGENT_SOCK=$(gpgconf --list-dirs | grep agent-socket | cut -d : -f 2)
export GPG_TTY=$(tty)
if [[ ! -S $AGENT_SOCK ]]; then
gpg-agent --daemon --use-standard-socket &>/dev/null
fi fi
export GPG_TTY=$TTY
# Set SSH to use gpg-agent if it is configured to do so # Set SSH to use gpg-agent if it's enabled
GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf" GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf"
if [ -r "$GNUPGCONFIG" ] && grep -q enable-ssh-support "$GNUPGCONFIG"; then if [[ -r $GNUPGCONFIG ]] && command grep -q enable-ssh-support "$GNUPGCONFIG"; then
export SSH_AUTH_SOCK="$AGENT_SOCK.ssh"
unset SSH_AGENT_PID unset SSH_AGENT_PID
export SSH_AUTH_SOCK=$GPG_AGENT_SOCKET
fi fi
## Gradle Plugin
This plugin adds completions and aliases for [Gradle](https://gradle.org/).
To use it, add `gradle` to the plugins array in your zshrc file:
```zsh
plugins=(... gradle)
```
## Usage
This plugin creates an alias `gradle` which is used to determine whether the current working directory has a gradlew file. If gradlew is present it will be used otherwise `gradle` is used directly. Gradle tasks can be executed directly without regard for whether it is `gradle` or `gradlew`
Examples:
```zsh
gradle test
gradle build
```
## Completion
The completion provided for this plugin caches the parsed tasks into a file named `.gradletasknamecache` in the current working directory, so you might want to add that to your `.gitignore` file so that it's not accidentally committed.
############################################################################## ##############################################################################
# A descriptive listing of core Gradle commands # A descriptive listing of core Gradle commands
############################################################################ ############################################################################
gradle-or-gradlew() {
if [ -f ./gradlew ] ; then
echo "executing gradlew instead of gradle";
./gradlew "$@";
else
gradle "$@";
fi
}
alias gradle=gradle-or-gradlew;
function _gradle_core_commands() { function _gradle_core_commands() {
local ret=1 state local ret=1 state
_arguments ':subcommand:->subcommand' && ret=0 _arguments ':subcommand:->subcommand' && ret=0
...@@ -88,7 +100,7 @@ function _gradle_arguments() { ...@@ -88,7 +100,7 @@ function _gradle_arguments() {
# and if so, regenerate the .gradle_tasks cache file # and if so, regenerate the .gradle_tasks cache file
############################################################################ ############################################################################
_gradle_does_task_list_need_generating () { _gradle_does_task_list_need_generating () {
[[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]] [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache || build.gradle.kts -nt .gradletasknamecache ]]
} }
############## ##############
...@@ -144,7 +156,7 @@ _gradle_parse_and_extract_tasks () { ...@@ -144,7 +156,7 @@ _gradle_parse_and_extract_tasks () {
# Discover the gradle tasks by running "gradle tasks --all" # Discover the gradle tasks by running "gradle tasks --all"
############################################################################ ############################################################################
_gradle_tasks () { _gradle_tasks () {
if [[ -f build.gradle ]]; then if [[ -f build.gradle || -f build.gradle.kts ]]; then
_gradle_arguments _gradle_arguments
if _gradle_does_task_list_need_generating; then if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache
...@@ -154,7 +166,7 @@ _gradle_tasks () { ...@@ -154,7 +166,7 @@ _gradle_tasks () {
} }
_gradlew_tasks () { _gradlew_tasks () {
if [[ -f build.gradle ]]; then if [[ -f build.gradle || -f build.gradle.kts ]]; then
_gradle_arguments _gradle_arguments
if _gradle_does_task_list_need_generating; then if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
......
# Grails plugin
This plugin adds completion for the [Grails 2 CLI](https://grails.github.io/grails2-doc/2.5.x/guide/commandLine.html)
To use it, add `grails` to the plugins array in your zshrc file:
```zsh
plugins=(... grails)
```
It looks for scripts in the following paths:
- `$GRAILS_HOME/scripts`
- `~/.grails/scripts`
- `./scripts`
- `./plugins/*/scripts`
## Grails Commands
- `add-proxy`
- `alias`
- `bootstrap`
- `bug-report`
- `clean`
- `clean-all`
- `clear-proxy`
- `compile`
- `console`
- `create-app`
- `create-controller`
- `create-domain-class`
- `create-filters`
- `create-integration-test`
- `create-multi-project-build`
- `create-plugin`
- `create-pom`
- `create-script`
- `create-service`
- `create-tag-lib`
- `create-unit-test`
- `dependency-report`
- `doc`
- `help`
- `init`
- `install-app-templates`
- `install-dependency`
- `install-plugin`
- `install-templates`
- `integrate-with`
- `interactive`
- `list-plugin-updates`
- `list-plugins`
- `migrate-docs`
- `package`
- `package-plugin`
- `plugin-info`
- `refresh-dependencies`
- `remove-proxy`
- `run-app`
- `run-script`
- `run-war`
- `set-grails-version`
- `set-proxy`
- `set-version`
- `shell`
- `stats`
- `stop-app`
- `test-app`
- `uninstall-plugin`
- `url-mappings-report`
- `war`
- `wrapper`
# grunt plugin
This plugin adds completions for [grunt](https://github.com/gruntjs/grunt).
To use it, add `grunt` to the plugins array of your `.zshrc` file:
```zsh
plugins=(... grunt)
```
## Enable caching
If you want to use the cache, set the following in your `.zshrc`:
```zsh
zstyle ':completion:*' use-cache yes
```
## Settings
* Show grunt file path:
```zsh
zstyle ':completion::complete:grunt::options:' show_grunt_path yes
```
* Cache expiration days (default: 7):
```zsh
zstyle ':completion::complete:grunt::options:' expire 1
```
* Not update options cache if target gruntfile is changed.
```zsh
zstyle ':completion::complete:grunt::options:' no_update_options yes
```
Note that if you change the zstyle settings, you should delete the cache file and restart zsh.
```zsh
$ rm ~/.zcompcache/grunt
$ exec zsh
```
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