0b757825a2c23af6fcf17f540cbfacd390321fa8

Author
Alexis GRIMALDI <alexis.grimaldi@gmail.com>
Committer
Alexis GRIMALDI <alexis.grimaldi@gmail.com>
Date

Message

Added git-extras completion

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..6adad124e3e8a4ef133e0643f8baec518bfba09b
  4--- /dev/null
  5+++ b/plugins/git-extras/git-extras.plugin.zsh
  6@@ -0,0 +1,265 @@
  7+#compdef git
  8+
  9+
 10+__git_command_successful () {
 11+    if (( ${#pipestatus:#0} > 0 )); then
 12+        _message 'not a git repository'
 13+        return 1
 14+    fi
 15+    return 0
 16+}
 17+
 18+
 19+__git_tag_names() {
 20+    local expl
 21+    declare -a tag_names
 22+    tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
 23+    __git_command_successful || return
 24+    _wanted tag-names expl tag-name compadd $* - $tag_names
 25+}
 26+
 27+
 28+__git_branch_names() {
 29+    local expl
 30+    declare -a branch_names
 31+    branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
 32+    __git_command_successful || return
 33+    _wanted branch-names expl branch-name compadd $* - $branch_names
 34+}
 35+
 36+
 37+__git_feature_branch_names() {
 38+    local expl
 39+    declare -a branch_names
 40+    branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
 41+    __git_command_successful || return
 42+    _wanted branch-names expl branch-name compadd $* - $branch_names
 43+}
 44+
 45+
 46+__git_refactor_branch_names() {
 47+    local expl
 48+    declare -a branch_names
 49+    branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
 50+    __git_command_successful || return
 51+    _wanted branch-names expl branch-name compadd $* - $branch_names
 52+}
 53+
 54+
 55+__git_bug_branch_names() {
 56+    local expl
 57+    declare -a branch_names
 58+    branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
 59+    __git_command_successful || return
 60+    _wanted branch-names expl branch-name compadd $* - $branch_names
 61+}
 62+
 63+
 64+__git_submodule_names() {
 65+    local expl
 66+    declare -a submodule_names
 67+    submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
 68+    __git_command_successful || return
 69+    _wanted submodule-names expl submodule-name compadd $* - $submodule_names
 70+}
 71+
 72+
 73+__git_author_names() {
 74+    local expl
 75+    declare -a author_names
 76+    author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
 77+    __git_command_successful || return
 78+    _wanted author-names expl author-name compadd $* - $author_names
 79+}
 80+
 81+
 82+_git-changelog() {
 83+    _arguments \
 84+        '(-l --list)'{-l, --list}'[list commits]' \
 85+}
 86+
 87+
 88+_git-effort() {
 89+    _arguments \
 90+        '--above[ignore file with less than x commits]' \
 91+}
 92+
 93+
 94+_git-contrib() {
 95+    _arguments \
 96+        ':author:__git_author_names'
 97+}
 98+
 99+
100+_git-count() {
101+    _arguments \
102+        '--all[detailed commit count]'
103+}
104+
105+