4cad0a48fdaf4389ab538556ed9a325a58470403
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
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..8419166abc10b7f05a30fe02d39aa34d3c33cddb
4--- /dev/null
5+++ b/plugins/git-extras/git-extras.plugin.zsh
6@@ -0,0 +1,285 @@
7+#compdef git
8+# ------------------------------------------------------------------------------
9+# Description
10+# -----------
11+#
12+# Completion script for git-extras (http://github.com/visionmedia/git-extras).
13+#
14+# ------------------------------------------------------------------------------
15+# Authors
16+# -------
17+#
18+# * Alexis GRIMALDI (https://github.com/agrimaldi)
19+#
20+# ------------------------------------------------------------------------------
21+# Inspirations
22+# -----------
23+#
24+# * git-extras (http://github.com/visionmedia/git-extras)
25+# * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
26+#
27+# ------------------------------------------------------------------------------
28+
29+
30+__git_command_successful () {
31+ if (( ${#pipestatus:#0} > 0 )); then
32+ _message 'not a git repository'
33+ return 1
34+ fi
35+ return 0
36+}
37+
38+
39+__git_tag_names() {
40+ local expl
41+ declare -a tag_names
42+ tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
43+ __git_command_successful || return
44+ _wanted tag-names expl tag-name compadd $* - $tag_names
45+}
46+
47+
48+__git_branch_names() {
49+ local expl
50+ declare -a branch_names
51+ branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
52+ __git_command_successful || return
53+ _wanted branch-names expl branch-name compadd $* - $branch_names
54+}
55+
56+
57+__git_feature_branch_names() {
58+ local expl
59+ declare -a branch_names
60+ branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
61+ __git_command_successful || return
62+ _wanted branch-names expl branch-name compadd $* - $branch_names
63+}
64+
65+
66+__git_refactor_branch_names() {
67+ local expl
68+ declare -a branch_names
69+ branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
70+ __git_command_successful || return
71+ _wanted branch-names expl branch-name compadd $* - $branch_names
72+}
73+
74+
75+__git_bug_branch_names() {
76+ local expl
77+ declare -a branch_names
78+ branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
79+ __git_command_successful || return
80+ _wanted branch-names expl branch-name compadd $* - $branch_names
81+}
82+
83+
84+__git_submodule_names() {
85+ local expl
86+ declare -a submodule_names
87+ submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
88+ __git_command_successful || return
89+ _wanted submodule-names expl submodule-name compadd $* - $submodule_names
90+}
91+
92+
93+__git_author_names() {
94+ local expl
95+ declare -a author_names
96+ author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
97+ __git_command_successful || return
98+ _wanted author-names expl author-name compadd $* - $author_names
99+}
100+
101+
102+_git-changelog() {
103+ _arguments \
104+ '(-l --list)'{-l,--list}'[list commits]' \
105+}