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

Merge branch 'master' into master

parents dd30cf10 3d8f2bda
## Aliases
alias dnfs="dnf search" # search package
alias dnfp="dnf info" # show package info
alias dnfl="dnf list" # list packages
alias dnfgl="dnf grouplist" # list package groups
alias dnfli="dnf list installed" # print all installed packages
alias dnfmc="dnf makecache" # rebuilds the dnf package list
alias dnfu="sudo dnf upgrade" # upgrade packages
alias dnfi="sudo dnf install" # install package
alias dnfgi="sudo dnf groupinstall" # install package group
alias dnfr="sudo dnf remove" # remove package
alias dnfgr="sudo dnf groupremove" # remove pagage group
alias dnfrl="sudo dnf remove --remove-leaves" # remove package and leaves
alias dnfc="sudo dnf clean all" # clean cache
../dnf/dnf.plugin.zsh
\ No newline at end of file
......@@ -6,7 +6,7 @@ alias fwrp="sudo firewall-cmd --runtime-to-permanent"
function fwl () {
# converts output to zsh array ()
# @f flag split on new line
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v interfaces)}")
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
for i in $zones; do
sudo firewall-cmd --zone $i --list-all
......
......@@ -4,7 +4,7 @@ Plugin for ForkLift, an FTP application for OS X.
### Requirements
* [ForkLift](http://www.binarynights.com/forklift/)
* [ForkLift](https://binarynights.com/)
### Usage
......
# Open folder in ForkLift.app or ForkLift2.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift2 by Johan Kaving
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
#
# Usage:
# fl [<folder>]
......@@ -24,46 +24,84 @@ function fl {
fi
osascript 2>&1 1>/dev/null <<END
try
tell application "Finder"
set appName to name of application file id "com.binarynights.ForkLift2"
end tell
on error err_msg number err_num
tell application "Finder"
set appName to name of application file id "com.binarynights.ForkLift"
end tell
end try
try
tell application "Finder"
set forkLift3 to name of application file id "com.binarynights.ForkLift-3"
end tell
on error err_msg number err_num
set forkLift3 to null
end try
try
tell application "Finder"
set forkLift2 to name of application file id "com.binarynights.ForkLift2"
end tell
on error err_msg number err_num
set forkLift2 to null
end try
try
tell application "Finder"
set forkLift to name of application file id "com.binarynights.ForkLift"
end tell
on error err_msg number err_num
set forkLift to null
end try
if application appName is running
tell application appName
if forkLift3 is not null and application forkLift3 is running then
tell application forkLift3
activate
end tell
else
tell application appName
set forkLiftVersion to version
end tell
else if forkLift2 is not null and application forkLift2 is running then
tell application forkLift2
activate
end tell
repeat until application appName is running
delay 1
end repeat
tell application appName
set forkLiftVersion to version
end tell
else if forkLift is not null and application forkLift is running then
tell application forkLift
activate
end tell
set forkLiftVersion to version
end tell
else
if forkLift3 is not null then
set appName to forkLift3
else if forkLift2 is not null then
set appName to forkLift2
else if forkLift is not null then
set appName to forkLift
end if
tell application appName
activate
set forkLiftVersion to version
end tell
repeat until application appName is running
delay 1
end repeat
tell application appName
activate
end tell
end if
tell application "System Events"
tell application process "ForkLift"
tell application "System Events"
tell application process "ForkLift"
try
set topWindow to window 1
set topWindow to window 1
on error
keystroke "n" using command down
set topWindow to window 1
keystroke "n" using command down
set topWindow to window 1
end try
keystroke "g" using {command down, shift down}
tell sheet 1 of topWindow
set value of text field 1 to "$PWD"
keystroke return
end tell
end tell
if forkLiftVersion starts with "3" then
tell pop over of list of group of splitter group of splitter group of topWindow
set value of text field 1 to "$PWD"
end tell
else
tell sheet 1 of topWindow
set value of text field 1 to "$PWD"
end tell
end if
keystroke return
end tell
end tell
END
}
......@@ -35,13 +35,13 @@ Available search contexts are:
| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` |
| aurajs | `http://aurajs.com/api/#stq=` |
| bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` |
| bootsnipp | `http://bootsnipp.com/search?q=` |
| caniuse | `http://caniuse.com/#search=` |
| codepen | `http://codepen.io/search?q=` |
| bootsnipp | `https://bootsnipp.com/search?q=` |
| caniuse | `https://caniuse.com/#search=` |
| codepen | `https://codepen.io/search?q=` |
| compassdoc | `http://compass-style.org/search?q=` |
| cssflow | `http://www.cssflow.com/search?q=` |
| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` |
| emberjs | `http://emberjs.com/api/#stp=1&stq=` |
| emberjs | `https://emberjs.com/api/#stp=1&stq=` |
| fontello | `http://fontello.com/#search=` |
| html5please | `http://html5please.com/#` |
| jquery | `https://api.jquery.com/?s=` |
......@@ -51,7 +51,7 @@ Available search contexts are:
| qunit | `https://api.qunitjs.com/?s=` |
| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |
| stackoverflow | `http://stackoverflow.com/search?q=` |
| stackoverflow | `https://stackoverflow.com/search?q=` |
| unheap | `http://www.unheap.com/?s=` |
If you want to have another context, open an Issue and tell us!
......@@ -62,4 +62,4 @@ If you want to have another context, open an Issue and tell us!
**Wilson Mendes (willmendesneto)**
+ <https://plus.google.com/+WilsonMendes>
+ <https://twitter.com/willmendesneto>
+ <http://github.com/willmendesneto>
+ <https://github.com/willmendesneto>
......@@ -29,13 +29,13 @@ function frontend() {
angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
aurajs 'http://aurajs.com/api/#stq='
bem 'https://google.com/search?as_sitesearch=bem.info&as_q='
bootsnipp 'http://bootsnipp.com/search?q='
caniuse 'http://caniuse.com/#search='
codepen 'http://codepen.io/search?q='
bootsnipp 'https://bootsnipp.com/search?q='
caniuse 'https://caniuse.com/#search='
codepen 'https://codepen.io/search?q='
compassdoc 'http://compass-style.org/search?q='
cssflow 'http://www.cssflow.com/search?q='
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
emberjs 'http://emberjs.com/api/#stp=1&stq='
emberjs 'https://emberjs.com/api/#stp=1&stq='
fontello 'http://fontello.com/#search='
html5please 'http://html5please.com/#'
jquery 'https://api.jquery.com/?s='
......@@ -45,7 +45,7 @@ function frontend() {
qunit 'https://api.qunitjs.com/?s='
reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q='
smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q='
stackoverflow 'http://stackoverflow.com/search?q='
stackoverflow 'https://stackoverflow.com/search?q='
unheap 'http://www.unheap.com/?s='
)
......
# fzf
This plugin enables [junegunn's fzf](https://github.com/junegunn/fzf) fuzzy auto-completion and key bindings
```zsh
# Set fzf installation directory path
export FZF_BASE=/path/to/fzf/install/dir
# Uncomment the following line to disable fuzzy completion
# export DISABLE_FZF_AUTO_COMPLETION="true"
# Uncomment the following line to disable key bindings (CTRL-T, CTRL-R, ALT-C)
# export DISABLE_FZF_KEY_BINDINGS="true"
plugins=(
...
fzf
)
```
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
if [[ -z "${fzf_base}" ]]; then
fzfdirs=(
"${HOME}/.fzf"
"/usr/local/opt/fzf"
"/usr/share/fzf"
)
for dir in ${fzfdirs}; do
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
break
fi
done
if [[ -z "${fzf_base}" ]]; then
if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
fi
fi
fi
fi
if [[ -n "${fzf_base}" ]]; then
# Fix fzf shell directory for Archlinux package
if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
fzf_shell="${fzf_base}"
else
fzf_shell="${fzf_base}/shell"
fi
# Setup fzf
# ---------
if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
export PATH="$PATH:$fzf_base/bin"
fi
# Auto-completion
# ---------------
if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
[[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
fi
# Key bindings
# ------------
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
source "${fzf_shell}/key-bindings.zsh"
fi
else
print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
"Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
fi
unset fzf_base fzf_shell dir fzfdirs
## ZSH-Geeknote
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh).
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
Plugins provides:
......
# Gem plugin
This plugin adds completions and aliases for [Gem](https://rubygems.org/). The completions include the common `gem` subcommands as well as the installed gems in the current directory.
To use it, add `gem` to the plugins array in your zshrc file:
```zsh
plugins=(... gem)
```
## Aliases
| Alias | Command | Description |
|----------------------|-------------------------------|--------------------------------------------|
| gemb | `gem build *.gemspec` | Build a gem from a gemspec |
| gemp | `gem push *.gem` | Push a gem up to the gem server |
| gemy [gem] [version] | `gem yank [gem] -v [version]` | Remove a pushed gem version from the index |
# Git auto-fetch
Automatically fetches all changes from all remotes while you are working in git-initialized directory.
#### Usage
Add `git-auto-fetch` to the plugins array in your zshrc file:
```shell
plugins=(... git-auto-fetch)
```
Every time you launch a command in your shell all remotes will be fetched in background.
By default autofetch will be triggered only if last fetch was done at least 60 seconds ago.
You can change fetch interval in your .zshrc:
```
GIT_AUTO_FETCH_INTERVAL=1200 #in seconds
```
Log of `git fetch --all` will be saved into `.git/FETCH_LOG`
#### Toggle auto fetch per folder
If you are using mobile connection or for any other reason you can disable git-auto-fetch for any folder:
```shell
$ cd to/your/project
$ git-auto-fetch
disabled
$ git-auto-fetch
enabled
```
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
function git-fetch-all {
(`git rev-parse --is-inside-work-tree 2>/dev/null` &&
dir=`git rev-parse --git-dir` &&
[[ ! -f $dir/NO_AUTO_FETCH ]] &&
(( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) &&
git fetch --all &>! $dir/FETCH_LOG &)
}
function git-auto-fetch {
`git rev-parse --is-inside-work-tree 2>/dev/null` || return
guard="`git rev-parse --git-dir`/NO_AUTO_FETCH"
(rm $guard 2>/dev/null &&
echo "${fg_bold[green]}enabled${reset_color}") ||
(touch $guard &&
echo "${fg_bold[red]}disabled${reset_color}")
}
eval "override-git-auto-fetch-$(declare -f zle-line-init)"
function zle-line-init () {
git-fetch-all
override-git-auto-fetch-zle-line-init
}
zle -N zle-line-init
# git-extras
This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras).
This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras).
## Setup notes
......
......@@ -2,7 +2,7 @@
# Description
# -----------
#
# Completion script for git-extras (http://github.com/tj/git-extras).
# Completion script for git-extras (https://github.com/tj/git-extras).
#
# This depends on and reuses some of the internals of the _git completion
# function that ships with zsh itself. It will not work with the _git that ships
......@@ -19,8 +19,8 @@
# Inspirations
# -----------
#
# * git-extras (http://github.com/tj/git-extras)
# * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
# * git-extras (https://github.com/tj/git-extras)
# * git-flow-completion (https://github.com/bobthecow/git-flow-completion)
#
# ------------------------------------------------------------------------------
......@@ -47,6 +47,14 @@ __gitex_commits() {
_describe -t commits commit commits && ret=0
}
__gitex_remote_names() {
local expl
declare -a remote_names
remote_names=(${(f)"$(_call_program remotes git remote 2>/dev/null)"})
__git_command_successful || return
_wanted remote-names expl remote-name compadd $* - $remote_names
}
__gitex_tag_names() {
local expl
declare -a tag_names
......@@ -69,7 +77,11 @@ __gitex_specific_branch_names() {
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
_wanted branch-names expl branch-name compadd - $branch_names
}
__gitex_chore_branch_names() {
__gitex_specific_branch_names 'chore'
}
__gitex_feature_branch_names() {
......@@ -102,6 +114,11 @@ __gitex_author_names() {
}
# subcommands
_git-authors() {
_arguments -C \
'(--list -l)'{--list,-l}'[show authors]' \
'--no-email[without email]' \
}
_git-bug() {
local curcontext=$curcontext state line ret=1
......@@ -126,8 +143,16 @@ _git-bug() {
_arguments -C \
':branch-name:__gitex_bug_branch_names'
;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
return 0
esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
......@@ -136,6 +161,40 @@ _git-changelog() {
'(-l --list)'{-l,--list}'[list commits]' \
}
_git-chore() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'finish:merge and delete the chore branch'
)
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(finish)
_arguments -C \
':branch-name:__gitex_chore_branch_names'
;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
return 0
esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
_git-contrib() {
......@@ -149,6 +208,27 @@ _git-count() {
'--all[detailed commit count]'
}
_git-create-branch() {
local curcontext=$curcontext state line
_arguments -C \
': :->command' \
'*:: :->option-or-argument'
case "$state" in
(command)
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
esac
}
_git-delete-branch() {
_arguments \
......@@ -220,10 +300,17 @@ _git-feature() {
_arguments -C \
':branch-name:__gitex_feature_branch_names'
;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
return 0
esac
}
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
_git-graft() {
_arguments \
......@@ -231,14 +318,39 @@ _git-graft() {
':dest-branch-name:__gitex_branch_names'
}
_git-guilt() {
_arguments -C \
'(--email -e)'{--email,-e}'[display author emails instead of names]' \
'(--ignore-whitespace -w)'{--ignore-whitespace,-w}'[ignore whitespace only changes]' \
'(--debug -d)'{--debug,-d}'[output debug information]' \
'-h[output usage information]'
}
_git-ignore() {
_arguments -C \
'(--local -l)'{--local,-l}'[show local gitignore]' \
'(--global -g)'{--global,-g}'[show global gitignore]'
'(--global -g)'{--global,-g}'[show global gitignore]' \
'(--private -p)'{--private,-p}'[show repo gitignore]'
}
_git-ignore() {
_arguments -C \
'(--append -a)'{--append,-a}'[append .gitignore]' \
'(--replace -r)'{--replace,-r}'[replace .gitignore]' \
'(--list-in-table -l)'{--list-in-table,-l}'[print available types in table format]' \
'(--list-alphabetically -L)'{--list-alphabetically,-L}'[print available types in alphabetical order]' \
'(--search -s)'{--search,-s}'[search word in available types]'
}
_git-merge-into() {
_arguments '--ff-only[merge only fast-forward]'
_arguments \
':src:__gitex_branch_names' \
':dest:__gitex_branch_names'
}
_git-missing() {
_arguments \
':first-branch-name:__gitex_branch_names' \
......@@ -269,8 +381,16 @@ _git-refactor() {
_arguments -C \
':branch-name:__gitex_refactor_branch_names'
;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
return 0
esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
......@@ -279,6 +399,23 @@ _git-squash() {
':branch-name:__gitex_branch_names'
}
_git-stamp() {
_arguments -C \
'(--replace -r)'{--replace,-r}'[replace stamps with same id]'
}
_git-standup() {
_arguments -C \
'-a[Specify the author of commits. Use "all" to specify all authors.]' \
'-d[Show history since N days ago]' \
'-D[Specify the date format displayed in commit history]' \
'-f[Fetch commits before showing history]' \
'-g[Display GPG signed info]' \
'-h[Display help message]' \
'-L[Enable the inclusion of symbolic links]' \
'-m[The depth of recursive directory search]'
}
_git-summary() {
_arguments '--line[summarize with lines rather than commits]'
__gitex_commits
......@@ -291,45 +428,71 @@ _git-undo(){
'(--hard -h)'{--hard,-h}'[wipes your commit(s)]'
}
zstyle ':completion:*:*:git:*' user-commands \
zstyle -g existing_user_commands ':completion:*:*:git:*' user-commands
zstyle ':completion:*:*:git:*' user-commands $existing_user_commands \
alias:'define, search and show aliases' \
archive-file:'export the current HEAD of the git repository to a archive' \
archive-file:'export the current head of the git repository to an archive' \
authors:'generate authors report' \
back:'undo and stage latest commits' \
bug:'create a bug branch' \
changelog:'populate changelog file with commits since the previous tag' \
commits-since:'list commits since a given date' \
contrib:'display author contributions' \
count:'count commits' \
create-branch:'create local and remote branch' \
delete-branch:'delete local and remote branch' \
delete-merged-branches:'delete merged branches'\
delete-submodule:'delete submodule' \
delete-tag:'delete local and remote tag' \
effort:'display effort statistics' \
extras:'git-extras' \
feature:'create a feature branch' \
bug:'create bug branch' \
bulk:'run bulk commands' \
changelog:'generate a changelog report' \
chore:'create chore branch' \
clear-soft:'soft clean up a repository' \
clear:'rigorously clean up a repository' \
commits-since:'show commit logs since some date' \
contrib:'show user contributions' \
count:'show commit count' \
create-branch:'create branches' \
delete-branch:'delete branches' \
delete-merged-branches:'delete merged branches' \
delete-submodule:'delete submodules' \
delete-tag:'delete tags' \
delta:'lists changed files' \
effort:'show effort statistics on file(s)' \
extras:'awesome git utilities' \
feature:'create/merge feature branch' \
force-clone:'overwrite local repositories with clone' \
fork:'fork a repo on github' \
fresh-branch:'create empty local branch' \
gh-pages:'create the GitHub Pages branch' \
graft:'merge commits from source branch to destination branch' \
ignore:'add patterns to .gitignore' \
info:'show info about the repository' \
local-commits:'list unpushed commits on the local branch' \
fresh-branch:'create fresh branches' \
gh-pages:'create the github pages branch' \
graft:'merge and destroy a given branch' \
guilt:'calculate change between two revisions' \
ignore-io:'get sample gitignore file' \
ignore:'add .gitignore patterns' \
info:'returns information on current repository' \
local-commits:'list local commits' \
lock:'lock a file excluded from version control' \
locked:'ls files that have been locked' \
merge-into:'merge one branch into another' \
merge-repo:'merge two repo histories' \
missing:'show commits missing from another branch' \
mr:'checks out a merge request locally' \
obliterate:'rewrite past commits to remove some files' \
pr:'checks out a pull request locally' \
psykorebase:'rebase a branch with a merge commit' \
pull-request:'create pull request to GitHub project' \
reauthor:'replace the author and/or committer identities in commits and tags' \
rebase-patch:'rebases a patch' \
refactor:'create a refactor branch' \
refactor:'create refactor branch' \
release:'commit, tag and push changes to the repository' \
rename-branch:'rename a branch' \
rename-tag:'rename a tag' \
repl:'read-eval-print-loop' \
repl:'git read-eval-print-loop' \
reset-file:'reset one file' \
root:'show path of root' \
setup:'setup a git repository' \
scp:'copy files to ssh compatible `git-remote`' \
sed:'replace patterns in git-controlled files' \
setup:'set up a git repository' \
show-merged-branches:'show merged branches' \
show-tree:'show branch tree of commit history' \
squash:'merge commits from source branch into the current one as a single commit' \
summary:'repository summary' \
touch:'one step creation of new files' \
undo:'remove the latest commit' \
show-unmerged-branches:'show unmerged branches' \
squash:'import changes from a branch' \
stamp:'stamp the last commit message' \
standup:'recall the commit history' \
summary:'show repository summary' \
sync:'sync local branch with remote branch' \
touch:'touch and add file to the index' \
undo:'remove latest commits' \
unlock:'unlock a file excluded from version control'
# git-flow (AVH Edition) plugin
This plugin adds completion for the [git-flow (AVH Edition)](https://github.com/petervanderdoes/gitflow-avh).
The AVH Edition of the git extensions that provides high-level repository operations for [Vincent Driessen's branching model](https://nvie.com/posts/a-successful-git-branching-model/).
To use it, add `git-flow-avh` to the plugins array in your zshrc file:
```zsh
plugins=(... git-flow-avh)
```
## Requirements
1. The git-flow tool has to be [installed](https://github.com/petervanderdoes/gitflow-avh#installing-git-flow)
separately.
2. You have to use zsh's git completion instead of the git project's git completion. This is typically
done by default so you don't need to do anything else. If you installed git with Homebrew you
might have to uninstall the git completion it's bundled with.
#!zsh
#
# Installation
# ------------
#
# To achieve git-flow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest verion.
# 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-flow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-flow-completion.zsh
#
# c. Or, use this file as a oh-my-zsh plugin.
#
_git-flow ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.'
'config:Manage your configuration.'
'release:Manage your release branches.'
'hotfix:Manage your hotfix branches.'
'support:Manage your support branches.'
'version:Shows version information.'
'finish:Finish the branch you are currently on.'
'delete:Delete the branch you are currently on.'
'publish:Publish the branch you are currently on.'
)
_describe -t commands 'git flow' subcommands
;;
(options)
case $line[1] in
(init)
_arguments \
-f'[Force setting of gitflow branches, even if already configured]'
;;
(version)
;;
(hotfix)
__git-flow-hotfix
;;
(release)
__git-flow-release
;;
(feature)
__git-flow-feature
;;
(config)
__git-flow-config
;;
esac
;;
esac
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.'
'bugfix:Manage your bugfix branches.'
'config:Manage your configuration.'
'release:Manage your release branches.'
'hotfix:Manage your hotfix branches.'
'support:Manage your support branches.'
'version:Shows version information.'
'finish:Finish the branch you are currently on.'
'delete:Delete the branch you are currently on.'
'publish:Publish the branch you are currently on.'
'rebase:Rebase the branch you are currently on.'
)
_describe -t commands 'git flow' subcommands
;;
(options)
case $line[1] in
(init)
_arguments \
-f'[Force setting of gitflow branches, even if already configured]'
;;
(version)
;;
(hotfix)
__git-flow-hotfix
;;
(release)
__git-flow-release
;;
(feature)
__git-flow-feature
;;
(bugfix)
__git-flow-bugfix
;;
(config)
__git-flow-config
;;
esac
;;
esac
}
__git-flow-release ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new release branch.'
'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish release branch to remote.'
'track:Checkout remote release branch.'
'delete:Delete a release branch.'
)
_describe -t commands 'git flow release' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':version:__git_flow_version_list'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
':version:__git_flow_version_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':version:__git_flow_version_list'
;;
(publish)
_arguments \
':version:__git_flow_version_list'
;;
(track)
_arguments \
':version:__git_flow_version_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new release branch.'
'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish release branch to remote.'
'track:Checkout remote release branch.'
'rebase:Rebase from integration branch.'
'delete:Delete a release branch.'
)
_describe -t commands 'git flow release' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':version:__git_flow_version_list'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
':version:__git_flow_version_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':version:__git_flow_version_list'
;;
(publish)
_arguments \
':version:__git_flow_version_list'
;;
(track)
_arguments \
':version:__git_flow_version_list'
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-flow-hotfix ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.'
'delete:Delete a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
)
_describe -t commands 'git flow hotfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':hotfix:__git_flow_version_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
':hotfix:__git_flow_hotfix_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':hotfix:__git_flow_hotfix_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.'
'delete:Delete a hotfix branch.'
'rebase:Rebase from integration branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
'rename:Rename a hotfix branch.'
)
_describe -t commands 'git flow hotfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':hotfix:__git_flow_version_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
':hotfix:__git_flow_hotfix_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':hotfix:__git_flow_hotfix_list'
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-flow-feature ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new feature branch.'
'finish:Finish a feature branch.'
'delete:Delete a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)'
'publish:Publish feature branch to remote.'
'track:Checkout remote feature branch.'
'diff:Show all changes.'
'rebase:Rebase from integration branch.'
'checkout:Checkout local feature branch.'
'pull:Pull changes from remote.'
)
_describe -t commands 'git flow feature' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':feature:__git_flow_feature_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Rebase instead of merge]'\
':feature:__git_flow_feature_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':feature:__git_flow_feature_list'
;;
(publish)
_arguments \
':feature:__git_flow_feature_list'\
;;
(track)
_arguments \
':feature:__git_flow_feature_list'\
;;
(diff)
_arguments \
':branch:__git_branch_names'\
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
(checkout)
_arguments \
':branch:__git_flow_feature_list'\
;;
(pull)
_arguments \
':remote:__git_remotes'\
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new feature branch.'
'finish:Finish a feature branch.'
'delete:Delete a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)'
'publish:Publish feature branch to remote.'
'track:Checkout remote feature branch.'
'diff:Show all changes.'
'rebase:Rebase from integration branch.'
'checkout:Checkout local feature branch.'
'pull:Pull changes from remote.'
'rename:Rename a feature branch.'
)
_describe -t commands 'git flow feature' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':feature:__git_flow_feature_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Rebase instead of merge]'\
':feature:__git_flow_feature_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':feature:__git_flow_feature_list'
;;
(publish)
_arguments \
':feature:__git_flow_feature_list'\
;;
(track)
_arguments \
':feature:__git_flow_feature_list'\
;;
(diff)
_arguments \
':branch:__git_branch_names'\
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
(checkout)
_arguments \
':branch:__git_flow_feature_list'\
;;
(pull)
_arguments \
':remote:__git_remotes'\
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-flow-bugfix ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new bugfix branch.'
'finish:Finish a bugfix branch.'
'delete:Delete a bugfix branch.'
'list:List all your bugfix branches. (Alias to `git flow bugfix`)'
'publish:Publish bugfix branch to remote.'
'track:Checkout remote bugfix branch.'
'diff:Show all changes.'
'rebase:Rebase from integration branch.'
'checkout:Checkout local bugfix branch.'
'pull:Pull changes from remote.'
'rename:Rename a bugfix branch.'
)
_describe -t commands 'git flow bugfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':bugfix:__git_flow_bugfix_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Rebase instead of merge]'\
':bugfix:__git_flow_bugfix_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':bugfix:__git_flow_bugfix_list'
;;
(publish)
_arguments \
':bugfix:__git_flow_bugfix_list'\
;;
(track)
_arguments \
':bugfix:__git_flow_bugfix_list'\
;;
(diff)
_arguments \
':branch:__git_branch_names'\
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
(checkout)
_arguments \
':branch:__git_flow_bugfix_list'\
;;
(pull)
_arguments \
':remote:__git_remotes'\
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-flow-config ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'list:List the configuration. (Alias to `git flow config`)'
'set:Set the configuration option'
)
_describe -t commands 'git flow config' subcommands
;;
(options)
case $line[1] in
(set)
_arguments \
--local'[Use repository config file]' \
--global'[Use global config file]'\
--system'[Use system config file]'\
--file'[Use given config file]'\
':option:(master develop feature hotfix release support versiontagprefix)'
;;
*)
_arguments \
--local'[Use repository config file]' \
--global'[Use global config file]'\
--system'[Use system config file]'\
--file'[Use given config file]'
;;
esac
;;
esac
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'list:List the configuration. (Alias to `git flow config`)'
'set:Set the configuration option'
)
_describe -t commands 'git flow config' subcommands
;;
(options)
case $line[1] in
(set)
_arguments \
--local'[Use repository config file]' \
--global'[Use global config file]'\
--system'[Use system config file]'\
--file'[Use given config file]'\
':option:(master develop feature hotfix release support versiontagprefix)'
;;
*)
_arguments \
--local'[Use repository config file]' \
--global'[Use global config file]'\
--system'[Use system config file]'\
--file'[Use given config file]'
;;
esac
;;
esac
}
__git_flow_version_list ()
{
local expl
declare -a versions
local expl
declare -a versions
versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted versions expl 'version' compadd $versions
_wanted versions expl 'version' compadd $versions
}
__git_flow_feature_list ()
{
local expl
declare -a features
local expl
declare -a features
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted features expl 'feature' compadd $features
}
__git_flow_bugfix_list ()
{
local expl
declare -a bugfixes
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
bugfixes=(${${(f)"$(_call_program bugfixes git flow bugfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted features expl 'feature' compadd $features
_wanted bugfixes expl 'bugfix' compadd $bugfixes
}
__git_remotes () {
local expl gitdir remotes
local expl gitdir remotes
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_command_successful || return
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_command_successful || return
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
__git_command_successful || return
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
__git_command_successful || return
# TODO: Should combine the two instead of either or.
if (( $#remotes > 0 )); then
_wanted remotes expl remote compadd $* - $remotes
else
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
fi
# TODO: Should combine the two instead of either or.
if (( $#remotes > 0 )); then
_wanted remotes expl remote compadd $* - $remotes
else
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
fi
}
__git_flow_hotfix_list ()
{
local expl
declare -a hotfixes
local expl
declare -a hotfixes
hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted hotfixes expl 'hotfix' compadd $hotfixes
_wanted hotfixes expl 'hotfix' compadd $hotfixes
}
__git_branch_names () {
local expl
declare -a branch_names
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
_wanted branch-names expl branch-name compadd $* - $branch_names
}
__git_command_successful () {
if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository'
return 1
fi
return 0
if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository'
return 1
fi
return 0
}
zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations'
......@@ -10,22 +10,23 @@ plugins=(... git-flow)
## Aliases
More information about `git-flow` commands:
More information about `git-flow` commands:
https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
| Alias | Command | Description |
|---------|---------------------------|----------------------------------------|
| `gfl` | `git flow` | Git-Flow command |
| `gfli` | `git flow init` | Initialize git-flow repository |
| `gcd` | `git checkout develop` | Check out develop branch |
| `gch` | `git checkout hotfix` | Check out hotfix branch |
| `gcr` | `git checkout release` | Check out release branch |
| `gflf` | `git flow feature` | List existing feature branches |
| `gflh` | `git flow hotfix` | List existing hotfix branches |
| `gflr` | `git flow release` | List existing release branches |
| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` |
| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` |
| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` |
| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` |
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
| Alias | Command | Description |
|---------|----------------------------|----------------------------------------|
| `gfl` | `git flow` | Git-Flow command |
| `gfli` | `git flow init` | Initialize git-flow repository |
| `gcd` | `git checkout develop` | Check out develop branch |
| `gch` | `git checkout hotfix` | Check out hotfix branch |
| `gcr` | `git checkout release` | Check out release branch |
| `gflf` | `git flow feature` | List existing feature branches |
| `gflh` | `git flow hotfix` | List existing hotfix branches |
| `gflr` | `git flow release` | List existing release branches |
| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` |
| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` |
| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` |
| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` |
| `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` |
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
......@@ -33,6 +33,7 @@ alias gflfs='git flow feature start'
alias gflhs='git flow hotfix start'
alias gflrs='git flow release start'
alias gflff='git flow feature finish'
alias gflfp='git flow feature publish'
alias gflhf='git flow hotfix finish'
alias gflrf='git flow release finish'
alias gflfp='git flow feature publish'
......
# git-hubflow plugin
This plugin adds completion for [HubFlow](https://datasift.github.io/gitflow/) (GitFlow for GitHub), as well as some
aliases for common commands. HubFlow is a git extension to make it easy to use GitFlow with GitHub. Based on the
original gitflow extension for git.
The hubflow tool has to be [installed](https://github.com/datasift/gitflow#installation) separately.
To use it, add `git-hubflow` to the plugins array in your zshrc file:
```zsh
plugins=(... git-hubflow)
```
## Aliases
| Alias | Command | Description |
|-------|------------------|------------------------------------------------------------------|
| ghf | `git hf` | Print command overview |
| ghff | `git hf feature` | Manage your feature branches |
| ghfr | `git hf release` | Manage your release branches |
| ghfh | `git hf hotfix` | Manage your hotfix branches |
| ghfs | `git hf support` | Manage your support branches |
| ghfu | `git hf update` | Pull upstream changes down into your master and develop branches |
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