aboutsummaryrefslogtreecommitdiff
path: root/zsh-completion/_gitbcheckout
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2018-11-29 13:21:09 +0100
committerKarel Kočí <karel.koci@nic.cz>2018-11-29 13:21:09 +0100
commit001e4f345bb8e267844f0eb7dafcbd824a3832f2 (patch)
tree126b576f1ea415a85bc7b91f5a1ced91785deac3 /zsh-completion/_gitbcheckout
parent4d70d5f316dc3721d36bd1f7c63247e56b667b20 (diff)
downloadshellrc-001e4f345bb8e267844f0eb7dafcbd824a3832f2.tar.gz
shellrc-001e4f345bb8e267844f0eb7dafcbd824a3832f2.tar.bz2
shellrc-001e4f345bb8e267844f0eb7dafcbd824a3832f2.zip
git: Add gitbcheckout
Diffstat (limited to 'zsh-completion/_gitbcheckout')
-rw-r--r--zsh-completion/_gitbcheckout16
1 files changed, 16 insertions, 0 deletions
diff --git a/zsh-completion/_gitbcheckout b/zsh-completion/_gitbcheckout
new file mode 100644
index 0000000..050457d
--- /dev/null
+++ b/zsh-completion/_gitbcheckout
@@ -0,0 +1,16 @@
+#compdef gitbmerge
+#autoload
+
+_gitbcheckout() {
+ ((CURRENT > 2)) && return # Complete only single branch
+ local gdir branch
+ gdir="$(git rev-parse --git-common-dir 2>/dev/null)" || return
+ local branches=()
+ while read -r branch; do
+ branches+=("$branch")
+ done < <(find "$gdir/refs/heads" "$gdir/refs/remotes" -mindepth 1 -printf '%P\n')
+ _describe -t branches 'gitbcheckout' branches
+}
+
+_gitbcheckout
+# vim: ft=zsh