3dc1d92950a087f50387e617de7c96ec1a6602fc

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #1442 from willman500/git-hub-flow-plugin

Add autocomplete for git "hubflow"

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/git-hubflow/git-hubflow.plugin.zsh b/plugins/git-hubflow/git-hubflow.plugin.zsh
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..a09f88391778e6af32ab4329aa53542a90f2ae80
  4--- /dev/null
  5+++ b/plugins/git-hubflow/git-hubflow.plugin.zsh
  6@@ -0,0 +1,348 @@
  7+#!zsh
  8+#
  9+# Installation
 10+# ------------
 11+#
 12+# To achieve git-hubflow completion nirvana:
 13+#
 14+#  0. Update your zsh's git-completion module to the newest verion.
 15+#     From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
 16+#
 17+#  1. Install this file. Either:
 18+#
 19+#     a. Place it in your .zshrc:
 20+#
 21+#     b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in
 22+#        your .zshrc:
 23+#
 24+#            source ~/.git-hubflow-completion.zsh
 25+#
 26+#     c. Or, use this file as a oh-my-zsh plugin.
 27+#
 28+
 29+_git-hf ()
 30+{
 31+    local curcontext="$curcontext" state line
 32+    typeset -A opt_args
 33+
 34+    _arguments -C \
 35+        ':command:->command' \
 36+        '*::options:->options'
 37+
 38+    case $state in
 39+        (command)
 40+
 41+            local -a subcommands
 42+            subcommands=(
 43+                'init:Initialize a new git repo with support for the branching model.'
 44+                'feature:Manage your feature branches.'
 45+                'release:Manage your release branches.'
 46+                'hotfix:Manage your hotfix branches.'
 47+                'support:Manage your support branches.'
 48+                'update:Pull upstream changes down into your master and develop branches.'
 49+                'version:Shows version information.'
 50+            )
 51+            _describe -t commands 'git hf' subcommands
 52+        ;;
 53+
 54+        (options)
 55+            case $line[1] in
 56+
 57+                (init)
 58+                    _arguments \
 59+                        -f'[Force setting of gitflow branches, even if already configured]'
 60+                ;;
 61+
 62+                (version)
 63+                ;;
 64+
 65+                (hotfix)
 66+                    __git-hf-hotfix
 67+                ;;
 68+
 69+                (release)
 70+                    __git-hf-release
 71+                ;;
 72+
 73+                (feature)
 74+                    __git-hf-feature
 75+                ;;
 76+            esac
 77+        ;;
 78+    esac
 79+}
 80+
 81+__git-hf-release ()
 82+{
 83+    local curcontext="$curcontext" state line
 84+    typeset -A opt_args
 85+
 86+    _arguments -C \
 87+        ':command:->command' \
 88+        '*::options:->options'
 89+
 90+    case $state in
 91+        (command)
 92+
 93+            local -a subcommands
 94+            subcommands=(
 95+                'start:Start a new release branch.'
 96+                'finish:Finish a release branch.'
 97+                'list:List all your release branches. (Alias to `git hf release`)'
 98+                'cancel:Cancel release'
 99+                'push:Push release to github'
100+                'pull:Pull release from github'
101+                'track:Track release'
102+            )
103+            _describe -t commands 'git hf release' subcommands
104+            _arguments \
105+                -v'[Verbose (more) output]'