Update git-flow completion

Add missing options and commands for support branches.
This commit is contained in:
Ben O'Hara 2013-02-24 18:44:09 +10:00
parent a182b009d0
commit 2314bc327a
1 changed files with 93 additions and 8 deletions

View File

@ -15,6 +15,7 @@
# * Yusuke Muraoka (https://github.com/jbking) # * Yusuke Muraoka (https://github.com/jbking)
# * Vincent Driessen (https://github.com/nvie) # * Vincent Driessen (https://github.com/nvie)
# * Zifei Tong (https://github.com/chevalun) # * Zifei Tong (https://github.com/chevalun)
# * Ben O'Hara (https://github.com/benohara)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -39,6 +40,7 @@ _git-flow ()
'hotfix:Manage your hotfix branches.' 'hotfix:Manage your hotfix branches.'
'support:Manage your support branches.' 'support:Manage your support branches.'
'version:Shows version information.' 'version:Shows version information.'
'status:Shows some status.'
) )
_describe -t commands 'git flow' subcommands _describe -t commands 'git flow' subcommands
;; ;;
@ -48,7 +50,8 @@ _git-flow ()
(init) (init)
_arguments \ _arguments \
-f'[Force setting of gitflow branches, even if already configured]' -f'[Force setting of gitflow branches, even if already configured]' \
-d'[Use defualt branch naming conventions and prefixes]'
;; ;;
(version) (version)
@ -65,6 +68,11 @@ _git-flow ()
(feature) (feature)
__git-flow-feature __git-flow-feature
;; ;;
(support)
__git-flow-support
;;
esac esac
;; ;;
esac esac
@ -87,6 +95,8 @@ __git-flow-release ()
'start:Start a new release branch.' 'start:Start a new release branch.'
'finish:Finish a release branch.' 'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)' 'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish this release banch to origin.`)'
'track:Track a release branch from origin.`)'
) )
_describe -t commands 'git flow release' subcommands _describe -t commands 'git flow release' subcommands
_arguments \ _arguments \
@ -108,10 +118,24 @@ __git-flow-release ()
-s'[Sign the release tag cryptographically]'\ -s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\ -u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\ -m'[Use the given tag message]'\
-n'[Dont tag this release ]'\
-p'[Push to $ORIGIN after performing finish]'\ -p'[Push to $ORIGIN after performing finish]'\
-k'[Keep branch after performing finish]'\
':version:__git_flow_version_list' ':version:__git_flow_version_list'
;; ;;
(publish)
_arguments \
':version:__git_flow_version_list'
;;
(track)
_arguments \
':version:__git_flow_version_list'
;;
*) *)
_arguments \ _arguments \
-v'[Verbose (more) output]' -v'[Verbose (more) output]'
@ -138,6 +162,7 @@ __git-flow-hotfix ()
'start:Start a new hotfix branch.' 'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.' 'finish:Finish a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)' 'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
'publish:Publish this hotfix branch to origin`)'
) )
_describe -t commands 'git flow hotfix' subcommands _describe -t commands 'git flow hotfix' subcommands
_arguments \ _arguments \
@ -164,6 +189,11 @@ __git-flow-hotfix ()
':hotfix:__git_flow_hotfix_list' ':hotfix:__git_flow_hotfix_list'
;; ;;
(publish)
_arguments \
':hotfix:__git_flow_hotfix_list'
;;
*) *)
_arguments \ _arguments \
-v'[Verbose (more) output]' -v'[Verbose (more) output]'
@ -190,12 +220,12 @@ __git-flow-feature ()
'start:Start a new feature branch.' 'start:Start a new feature branch.'
'finish:Finish a feature branch.' 'finish:Finish a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)' 'list:List all your feature branches. (Alias to `git flow feature`)'
'publish: public' 'publish:Publish this feature branch to origin.'
'track: track' 'track:Track a feature branch from origin.'
'diff: diff' 'diff:Show a diff of changes since this feature branched off.'
'rebase: rebase' 'rebase:Rebase a feature branch on top of develop.'
'checkout: checkout' 'checkout:Check out (switch to) the given feature branch.'
'pull: pull' 'pull:Pull a feature branch from a remote peer.'
) )
_describe -t commands 'git flow feature' subcommands _describe -t commands 'git flow feature' subcommands
_arguments \ _arguments \
@ -215,7 +245,9 @@ __git-flow-feature ()
(finish) (finish)
_arguments \ _arguments \
-F'[Fetch from origin before performing finish]' \ -F'[Fetch from origin before performing finish]' \
-r'[Rebase instead of merge]'\ -r'[Finish branch by rebasing first]'\
-k'[Keep branch after performing finish]'\
-D'[Force delete feature branch after finish]'\
':feature:__git_flow_feature_list' ':feature:__git_flow_feature_list'
;; ;;
@ -260,6 +292,47 @@ __git-flow-feature ()
esac esac
} }
__git-flow-support ()
{
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 support branch.'
'list:List all your support branches. (Alias to `git flow support`)'
)
_describe -t commands 'git flow support' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':feature:__git_flow_support_list'\
':branch-name:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git_flow_version_list () __git_flow_version_list ()
{ {
local expl local expl
@ -310,6 +383,18 @@ __git_flow_hotfix_list ()
_wanted hotfixes expl 'hotfix' compadd $hotfixes _wanted hotfixes expl 'hotfix' compadd $hotfixes
} }
__git_flow_support_list ()
{
local expl
declare -a support
support=(${${(f)"$(_call_program support git flow support list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted hotfixes expl 'support' compadd $support
}
__git_branch_names () { __git_branch_names () {
local expl local expl
declare -a branch_names declare -a branch_names