1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-12 08:50:08 +00:00

Update git-flow-avh to 0.6.0 (#6498)

This updates the git-flow-avh plugin to the latest version
from https://github.com/petervanderdoes/git-flow-completion
(0.6.0 at the time of this commit).

This mainly adds support for the "git flow bugfix" command.

This PR replaces #4626 as well as #4705, both of which adds support for the bugfix command but doesn't use the official version from https://github.com/petervanderdoes/git-flow-completion

Fixes #4705
Fixes #4626
Fixes #5903
This commit is contained in:
Johan Kaving 2018-07-19 16:53:19 +02:00 committed by Marc Cornellà
parent a3ab45db8b
commit 626b30b2a3

129
plugins/git-flow-avh/git-flow-avh.plugin.zsh Normal file → Executable file
View file

@ -36,6 +36,7 @@ _git-flow ()
subcommands=( subcommands=(
'init:Initialize a new git repo with support for the branching model.' 'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.' 'feature:Manage your feature branches.'
'bugfix:Manage your bugfix branches.'
'config:Manage your configuration.' 'config:Manage your configuration.'
'release:Manage your release branches.' 'release:Manage your release branches.'
'hotfix:Manage your hotfix branches.' 'hotfix:Manage your hotfix branches.'
@ -44,6 +45,7 @@ _git-flow ()
'finish:Finish the branch you are currently on.' 'finish:Finish the branch you are currently on.'
'delete:Delete the branch you are currently on.' 'delete:Delete the branch you are currently on.'
'publish:Publish 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 _describe -t commands 'git flow' subcommands
;; ;;
@ -70,6 +72,10 @@ _git-flow ()
(feature) (feature)
__git-flow-feature __git-flow-feature
;; ;;
(bugfix)
__git-flow-bugfix
;;
(config) (config)
__git-flow-config __git-flow-config
;; ;;
@ -98,6 +104,7 @@ __git-flow-release ()
'list:List all your release branches. (Alias to `git flow release`)' 'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish release branch to remote.' 'publish:Publish release branch to remote.'
'track:Checkout remote release branch.' 'track:Checkout remote release branch.'
'rebase:Rebase from integration branch.'
'delete:Delete a release branch.' 'delete:Delete a release branch.'
) )
_describe -t commands 'git flow release' subcommands _describe -t commands 'git flow release' subcommands
@ -141,6 +148,12 @@ __git-flow-release ()
':version:__git_flow_version_list' ':version:__git_flow_version_list'
;; ;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
*) *)
_arguments \ _arguments \
-v'[Verbose (more) output]' -v'[Verbose (more) output]'
@ -167,7 +180,9 @@ __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.'
'delete:Delete a hotfix branch.' 'delete:Delete a hotfix branch.'
'rebase:Rebase from integration branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)' 'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
'rename:Rename a hotfix branch.'
) )
_describe -t commands 'git flow hotfix' subcommands _describe -t commands 'git flow hotfix' subcommands
_arguments \ _arguments \
@ -201,6 +216,12 @@ __git-flow-hotfix ()
':hotfix:__git_flow_hotfix_list' ':hotfix:__git_flow_hotfix_list'
;; ;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
*) *)
_arguments \ _arguments \
-v'[Verbose (more) output]' -v'[Verbose (more) output]'
@ -234,6 +255,7 @@ __git-flow-feature ()
'rebase:Rebase from integration branch.' 'rebase:Rebase from integration branch.'
'checkout:Checkout local feature branch.' 'checkout:Checkout local feature branch.'
'pull:Pull changes from remote.' 'pull:Pull changes from remote.'
'rename:Rename a feature branch.'
) )
_describe -t commands 'git flow feature' subcommands _describe -t commands 'git flow feature' subcommands
_arguments \ _arguments \
@ -305,6 +327,102 @@ __git-flow-feature ()
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 () __git-flow-config ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
@ -370,6 +488,17 @@ __git_flow_feature_list ()
_wanted features expl 'feature' compadd $features _wanted features expl 'feature' compadd $features
} }
__git_flow_bugfix_list ()
{
local expl
declare -a bugfixes
bugfixes=(${${(f)"$(_call_program bugfixes git flow bugfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted bugfixes expl 'bugfix' compadd $bugfixes
}
__git_remotes () { __git_remotes () {
local expl gitdir remotes local expl gitdir remotes