Skip to content

Commit

Permalink
Add autocomplete for 'help' commands and subcommands.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthecow committed Oct 21, 2010
1 parent e3f5953 commit b2fd9a6
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions git-flow-completion.bash
Expand Up @@ -9,7 +9,7 @@
#
# * git-flow init and version
# * feature, hotfix and release branches
# * remote feature branch names (for `git-flow feature track`)
# * remote feature, hotfix and release branch names
#
#
# Installation
Expand Down Expand Up @@ -47,14 +47,18 @@

_git_flow ()
{
local subcommands="init feature release hotfix"
local subcommands="init feature release hotfix help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi

case "$subcommand" in
init)
__git_flow_init
return
;;
feature)
__git_flow_feature
return
Expand All @@ -73,9 +77,19 @@ _git_flow ()
esac
}

__git_flow_init ()
{
local subcommands="help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi
}

__git_flow_feature ()
{
local subcommands="list start finish publish track diff rebase checkout pull"
local subcommands="list start finish publish track diff rebase checkout pull help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
Expand Down Expand Up @@ -124,7 +138,7 @@ __git_flow_feature_prefix ()

__git_flow_release ()
{
local subcommands="list start finish"
local subcommands="list start finish help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
Expand Down Expand Up @@ -156,7 +170,7 @@ __git_flow_release_prefix ()

__git_flow_hotfix ()
{
local subcommands="list start finish"
local subcommands="list start finish help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
Expand Down

0 comments on commit b2fd9a6

Please sign in to comment.