Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'release/0.4.2'

  • Loading branch information...
commit e664f8d71ba639153e3ca822a056342548f2abca 2 parents 429930f + 80d3646
@bobthecow authored
View
51 README.markdown
@@ -1,7 +1,7 @@
git-flow-completion
===================
-Bash and Zsh completion support for [git-flow](http://github.com/nvie/gitflow)
+Bash, Zsh and fish completion support for [git-flow](http://github.com/nvie/gitflow).
The contained completion routines provide support for completing:
@@ -17,23 +17,28 @@ To achieve git-flow completion nirvana:
0. [Install git-completion](http://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion).
- 1. Install this file. Either:
+ 1. Install `git-flow-completion.bash`. Either:
- a. Place it in a `bash_completion.d` folder:
+ 1. Place it in your `bash_completion.d` folder, usually something like `/etc/bash_completion.d`,
+ `/usr/local/etc/bash_completion.d` or `~/bash_completion.d`.
- * /etc/bash_completion.d
- * /usr/local/etc/bash_completion.d
- * ~/bash_completion.d
+ 2. Or, copy it somewhere (e.g. `~/.git-flow-completion.sh`) and put the following line in the `.profile` or
+ `.bashrc` file in your home directory:
- b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in
- your .bashrc:
+ source ~/.git-flow-completion.sh
- source ~/.git-flow-completion.sh
+ 2. If you are using Git < 1.7.1, you will need to edit git completion (usually `/etc/bash_completion.d/git` or
+ `git-completion.sh`) and add the following line to the `$command` case in `_git`:
- 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant
- $command case in _git:
-
- flow) _git_flow ;;
+ _git ()
+ {
+ [...]
+ case "$command" in
+ [...]
+ flow) _git_flow ;;
+ *) COMPREPLY=() ;;
+ esac
+ }
Installation for Zsh
@@ -44,16 +49,24 @@ To achieve git-flow completion nirvana:
0. Update your zsh's git-completion module to the newest verion --
[available 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:
+ 1. Install `git-flow-completion.zsh`. Either:
+
+ 1. Place it in your `.zshrc`.
+
+ 2. Or, copy it somewhere (e.g. `~/.git-flow-completion.zsh`) and put the following line in
+ your `.zshrc`:
+
+ source ~/.git-flow-completion.zsh
- a. Place it in your .zshrc:
+ 3. Or, use this file as an oh-my-zsh plugin.
- b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in
- your .zshrc:
- source ~/.git-flow-completion.zsh
+Installation for fish
+---------------------
+
+To achieve git-flow completion nirvana:
- c. Or, use this file as an oh-my-zsh plugin.
+ 1. Install `git.fish` in your `~/.config/fish/completions` folder.
The Fine Print
View
22 git-flow-completion.bash
@@ -47,7 +47,7 @@
_git_flow ()
{
- local subcommands="init feature release hotfix help version"
+ local subcommands="init feature release hotfix support help version"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
@@ -71,6 +71,10 @@ _git_flow ()
__git_flow_hotfix
return
;;
+ support)
+ __git_flow_support
+ return
+ ;;
*)
COMPREPLY=()
;;
@@ -168,6 +172,22 @@ __git_flow_hotfix ()
esac
}
+__git_flow_support ()
+{
+ local subcommands="list start help"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
+ if [ -z "$subcommand" ]; then
+ __gitcomp "$subcommands"
+ return
+ fi
+
+ case "$subcommand" in
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+}
+
__git_flow_prefix ()
{
case "$1" in
View
26 git-flow-completion.zsh
@@ -88,6 +88,8 @@ __git-flow-release ()
'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.'
)
_describe -t commands 'git flow release' subcommands
_arguments \
@@ -113,6 +115,16 @@ __git-flow-release ()
':version:__git_flow_version_list'
;;
+ (publish)
+ _arguments \
+ ':version:__git_flow_version_list'
+ ;;
+
+ (track)
+ _arguments \
+ ':version:__git_flow_version_list'
+ ;;
+
*)
_arguments \
-v'[Verbose (more) output]'
@@ -191,12 +203,12 @@ __git-flow-feature ()
'start:Start a new feature branch.'
'finish:Finish a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)'
- 'publish: public'
- 'track: track'
- 'diff: diff'
- 'rebase: rebase'
- 'checkout: checkout'
- 'pull: pull'
+ '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 \
@@ -329,4 +341,4 @@ __git_command_successful () {
return 0
}
-zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
+zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
View
192 git.fish
@@ -0,0 +1,192 @@
+#!fish
+#
+# git-flow-completion
+# ===================
+#
+# Fish completion support for [git-flow](http://github.com/nvie/gitflow)
+#
+# The contained completion routines provide support for completing:
+#
+# * git-flow init and version
+# * feature, hotfix and release branches
+# * remote feature, hotfix and release branch names
+#
+#
+# Installation
+# ------------
+#
+# To achieve git-flow completion nirvana:
+#
+# 1. Install this file in your `~/.config/fish/completions` folder.
+#
+#
+# The Fine Print
+# --------------
+#
+# Copyright (c) 2012 [Justin Hileman](http://justinhileman.com)
+#
+# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
+
+for prefix in /usr /usr/local
+ if test -f $prefix/share/fish/completions/git.fish
+ . $prefix/share/fish/completions/git.fish
+ break
+ end
+end
+
+if not functions -q __fish_git_branches
+ echo \nError: git completion not found >&2
+ exit
+end
+
+## Support functions
+
+function __fish_git_flow_using_command
+ set cmd (commandline -opc)
+ set subcommands 'flow' $argv
+ if [ (count $cmd) = (math (count $subcommands) + 1) ]
+ for i in (seq (count $subcommands))
+ if not test $subcommands[$i] = $cmd[(math $i + 1)]
+ return 1
+ end
+ end
+ return 0
+ end
+ return 1
+end
+
+function __fish_git_flow_prefix
+ git config "gitflow.prefix.$argv[1]" 2> /dev/null; or echo "$argv[1]/"
+end
+
+function __fish_git_flow_branches
+ set prefix (__fish_git_flow_prefix $argv[1])
+ __fish_git_branches | grep "^$prefix" | sed "s,^$prefix,," | sort
+end
+
+function __fish_git_flow_remote_branches
+ set prefix (__fish_git_flow_prefix $argv[1])
+ set origin (git config gitflow.origin 2> /dev/null; or echo "origin")
+ git branch -r 2> /dev/null | sed "s/^ *//g" | grep "^$origin/$prefix" | sed "s,^$origin/$prefix,," | sort
+end
+
+function __fish_git_flow_untracked_branches
+ set branches (__fish_git_flow_branches $argv[1])
+ for branch in (__fish_git_flow_remote_branches $argv[1])
+ if not contains $branch $branches
+ echo $branch
+ end
+ end
+end
+
+function __fish_git_flow_unpublished_branches
+ set branches (__fish_git_flow_remote_branches $argv[1])
+ for branch in (__fish_git_flow_branches $argv[1])
+ if not contains $branch $branches
+ echo $branch
+ end
+ end
+end
+
+
+## git-flow
+
+complete -f -c git -n '__fish_git_needs_command' -a flow -d 'Manage a git-flow enabled repository'
+complete -f -c git -n '__fish_git_flow_using_command' -a version -d 'Show version information'
+
+
+
+## git-flow init
+
+complete -f -c git -n '__fish_git_flow_using_command' -a init -d 'Initialize a new git repo with support for the branching model'
+complete -f -c git -n '__fish_git_flow_using_command init' -s f -d 'Force reinitialization'
+complete -f -c git -n '__fish_git_flow_using_command init' -s d -d 'Use default branch names'
+
+
+
+## git-flow feature
+
+complete -f -c git -n '__fish_git_flow_using_command' -a feature -d 'Manage feature branches'
+complete -f -c git -n '__fish_git_flow_using_command feature' -a list -d 'List feature branches'
+complete -f -c git -n '__fish_git_flow_using_command feature' -s v -d 'Verbose output'
+
+complete -f -c git -n '__fish_git_flow_using_command feature' -a start -d 'Start a new feature branch'
+complete -f -c git -n '__fish_git_flow_using_command feature start' -s F -d 'Fetch from origin first'
+
+complete -f -c git -n '__fish_git_flow_using_command feature' -a finish -d 'Finish a feature branch'
+complete -f -c git -n '__fish_git_flow_using_command feature finish' -s F -d 'Fetch from origin first'
+complete -f -c git -n '__fish_git_flow_using_command feature finish' -s r -d 'Rebase instead of merging'
+complete -f -c git -n '__fish_git_flow_using_command feature finish' -a '(__fish_git_flow_branches feature)' -d 'Feature branch'
+
+complete -f -c git -n '__fish_git_flow_using_command feature' -a publish -d 'Publish a feature branch to remote'
+complete -f -c git -n '__fish_git_flow_using_command feature publish' -a '(__fish_git_flow_unpublished_branches feature)' -d 'Feature branch'
+
+complete -f -c git -n '__fish_git_flow_using_command feature' -a track -d 'Checkout remote feature branch'
+complete -f -c git -n '__fish_git_flow_using_command feature track' -a '(__fish_git_flow_untracked_branches feature)' -d 'Feature branch'
+
+complete -f -c git -n '__fish_git_flow_using_command feature' -a diff -d 'Show all changes'
+
+complete -f -c git -n '__fish_git_flow_using_command feature' -a rebase -d 'Rebase against integration branch'
+complete -f -c git -n '__fish_git_flow_using_command feature rebase' -s i -d 'Do an interactive rebase'
+
+complete -f -c git -n '__fish_git_flow_using_command feature' -a checkout -d 'Checkout local feature branch'
+complete -f -c git -n '__fish_git_flow_using_command feature checkout' -a '(__fish_git_flow_branches feature)' -d 'Feature branch'
+
+complete -f -c git -n '__fish_git_flow_using_command feature' -a pull -d 'Pull changes from remote'
+complete -f -c git -n '__fish_git_flow_using_command feature pull' -a '(__fish_git_remotes)' -d 'Remote'
+
+
+
+## git-flow release
+
+complete -f -c git -n '__fish_git_flow_using_command' -a release -d 'Manage release branches'
+complete -f -c git -n '__fish_git_flow_using_command release' -a list -d 'List release branches'
+complete -f -c git -n '__fish_git_flow_using_command release' -s v -d 'Verbose output'
+
+complete -f -c git -n '__fish_git_flow_using_command release' -a start -d 'Start a new release branch'
+complete -f -c git -n '__fish_git_flow_using_command release start' -s F -d 'Fetch from origin first'
+
+complete -f -c git -n '__fish_git_flow_using_command release' -a finish -d 'Finish a release branch'
+complete -f -c git -n '__fish_git_flow_using_command release finish' -s F -d 'Fetch from origin first'
+complete -f -c git -n '__fish_git_flow_using_command release finish' -s s -d 'Sign the release tag cryptographically'
+complete -f -c git -n '__fish_git_flow_using_command release finish' -s u -d 'Use the given GPG-key for the digital signature (implies -s)'
+complete -f -c git -n '__fish_git_flow_using_command release finish' -s m -d 'Use the given tag message'
+complete -f -c git -n '__fish_git_flow_using_command release finish' -s p -d 'Push to $ORIGIN after performing finish'
+complete -f -c git -n '__fish_git_flow_using_command release finish' -a '(__fish_git_flow_branches release)' -d 'Release branch'
+
+complete -f -c git -n '__fish_git_flow_using_command release' -a publish -d 'Publish a release branch to remote'
+complete -f -c git -n '__fish_git_flow_using_command release publish' -a '(__fish_git_flow_unpublished_branches release)' -d 'Release branch'
+
+complete -f -c git -n '__fish_git_flow_using_command release' -a track -d 'Checkout remote release branch'
+complete -f -c git -n '__fish_git_flow_using_command release track' -a '(__fish_git_flow_untracked_branches release)' -d 'Release branch'
+
+
+
+## git-flow hotfix
+
+complete -f -c git -n '__fish_git_flow_using_command' -a hotfix -d 'Manage hotfix branches'
+complete -f -c git -n '__fish_git_flow_using_command hotfix' -a list -d 'List hotfix branches'
+complete -f -c git -n '__fish_git_flow_using_command hotfix' -s v -d 'Verbose output'
+
+complete -f -c git -n '__fish_git_flow_using_command hotfix' -a start -d 'Start a new hotfix branch'
+complete -f -c git -n '__fish_git_flow_using_command hotfix start' -s F -d 'Fetch from origin first'
+
+complete -f -c git -n '__fish_git_flow_using_command hotfix' -a finish -d 'Finish a hotfix branch'
+complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s F -d 'Fetch from origin first'
+complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s s -d 'Sign the hotfix tag cryptographically'
+complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s u -d 'Use the given GPG-key for the digital signature (implies -s)'
+complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s m -d 'Use the given tag message'
+complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s p -d 'Push to $ORIGIN after performing finish'
+complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -a '(__fish_git_flow_branches hotfix)' -d 'Hotfix branch'
+
+
+
+## git-flow support
+
+complete -f -c git -n '__fish_git_flow_using_command' -a support -d 'Manage support branches'
+complete -f -c git -n '__fish_git_flow_using_command support' -a list -d 'List support branches'
+complete -f -c git -n '__fish_git_flow_using_command support' -s v -d 'Verbose output'
+
+complete -f -c git -n '__fish_git_flow_using_command support' -a start -d 'Start a new support branch'
+complete -f -c git -n '__fish_git_flow_using_command support start' -s F -d 'Fetch from origin first'
+
Please sign in to comment.
Something went wrong with that request. Please try again.