Update git-flow completion
Add missing options and commands for support branches.
This commit is contained in:
		
							parent
							
								
									a182b009d0
								
							
						
					
					
						commit
						2314bc327a
					
				
							
								
								
									
										101
									
								
								src/_git-flow
								
								
								
								
							
							
						
						
									
										101
									
								
								src/_git-flow
								
								
								
								
							| 
						 | 
				
			
			@ -15,6 +15,7 @@
 | 
			
		|||
#  * Yusuke Muraoka (https://github.com/jbking)
 | 
			
		||||
#  * Vincent Driessen (https://github.com/nvie)
 | 
			
		||||
#  * Zifei Tong (https://github.com/chevalun)
 | 
			
		||||
#  * Ben O'Hara (https://github.com/benohara)
 | 
			
		||||
#
 | 
			
		||||
# ------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +40,7 @@ _git-flow ()
 | 
			
		|||
				'hotfix:Manage your hotfix branches.'
 | 
			
		||||
				'support:Manage your support branches.'
 | 
			
		||||
				'version:Shows version information.'
 | 
			
		||||
				'status:Shows some status.'
 | 
			
		||||
			)
 | 
			
		||||
			_describe -t commands 'git flow' subcommands
 | 
			
		||||
		;;
 | 
			
		||||
| 
						 | 
				
			
			@ -48,7 +50,8 @@ _git-flow ()
 | 
			
		|||
 | 
			
		||||
				(init)
 | 
			
		||||
					_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)
 | 
			
		||||
| 
						 | 
				
			
			@ -65,6 +68,11 @@ _git-flow ()
 | 
			
		|||
					(feature)
 | 
			
		||||
						__git-flow-feature
 | 
			
		||||
					;;
 | 
			
		||||
 | 
			
		||||
          (support)
 | 
			
		||||
						__git-flow-support
 | 
			
		||||
					;;
 | 
			
		||||
 | 
			
		||||
			esac
 | 
			
		||||
		;;
 | 
			
		||||
	esac
 | 
			
		||||
| 
						 | 
				
			
			@ -87,6 +95,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 this release banch to origin.`)'
 | 
			
		||||
				'track:Track a release branch from origin.`)'
 | 
			
		||||
			)
 | 
			
		||||
			_describe -t commands 'git flow release' subcommands
 | 
			
		||||
			_arguments \
 | 
			
		||||
| 
						 | 
				
			
			@ -108,10 +118,24 @@ __git-flow-release ()
 | 
			
		|||
						-s'[Sign the release tag cryptographically]'\
 | 
			
		||||
						-u'[Use the given GPG-key for the digital signature (implies -s)]'\
 | 
			
		||||
						-m'[Use the given tag message]'\
 | 
			
		||||
						-n'[Dont tag this release ]'\
 | 
			
		||||
						-p'[Push to $ORIGIN after performing finish]'\
 | 
			
		||||
						-k'[Keep branch after performing finish]'\
 | 
			
		||||
						':version:__git_flow_version_list'
 | 
			
		||||
				;;
 | 
			
		||||
 | 
			
		||||
				(publish)
 | 
			
		||||
					_arguments \
 | 
			
		||||
						':version:__git_flow_version_list'
 | 
			
		||||
				;;
 | 
			
		||||
 | 
			
		||||
				(track)
 | 
			
		||||
					_arguments \
 | 
			
		||||
						':version:__git_flow_version_list'
 | 
			
		||||
				;;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
				*)
 | 
			
		||||
					_arguments \
 | 
			
		||||
						-v'[Verbose (more) output]'
 | 
			
		||||
| 
						 | 
				
			
			@ -138,6 +162,7 @@ __git-flow-hotfix ()
 | 
			
		|||
				'start:Start a new hotfix branch.'
 | 
			
		||||
				'finish:Finish a hotfix branch.'
 | 
			
		||||
				'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
 | 
			
		||||
			_arguments \
 | 
			
		||||
| 
						 | 
				
			
			@ -164,6 +189,11 @@ __git-flow-hotfix ()
 | 
			
		|||
						':hotfix:__git_flow_hotfix_list'
 | 
			
		||||
				;;
 | 
			
		||||
 | 
			
		||||
				(publish)
 | 
			
		||||
					_arguments \
 | 
			
		||||
						':hotfix:__git_flow_hotfix_list'
 | 
			
		||||
				;;
 | 
			
		||||
 | 
			
		||||
				*)
 | 
			
		||||
					_arguments \
 | 
			
		||||
						-v'[Verbose (more) output]'
 | 
			
		||||
| 
						 | 
				
			
			@ -190,12 +220,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 this feature branch to origin.'
 | 
			
		||||
				'track:Track a feature branch from origin.'
 | 
			
		||||
				'diff:Show a diff of changes since this feature branched off.'
 | 
			
		||||
				'rebase:Rebase a feature branch on top of develop.'
 | 
			
		||||
        'checkout:Check out (switch to) the given feature branch.'
 | 
			
		||||
				'pull:Pull a feature branch from a remote peer.'
 | 
			
		||||
			)
 | 
			
		||||
			_describe -t commands 'git flow feature' subcommands
 | 
			
		||||
			_arguments \
 | 
			
		||||
| 
						 | 
				
			
			@ -215,7 +245,9 @@ __git-flow-feature ()
 | 
			
		|||
				(finish)
 | 
			
		||||
					_arguments \
 | 
			
		||||
						-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'
 | 
			
		||||
				;;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -260,6 +292,47 @@ __git-flow-feature ()
 | 
			
		|||
	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 ()
 | 
			
		||||
{
 | 
			
		||||
	local expl
 | 
			
		||||
| 
						 | 
				
			
			@ -310,6 +383,18 @@ __git_flow_hotfix_list ()
 | 
			
		|||
	_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 () {
 | 
			
		||||
	local expl
 | 
			
		||||
	declare -a branch_names
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue