]> git.rmz.io Git - dotfiles.git/blob - zsh/aliases/git-extras.zsh
enable using wlan
[dotfiles.git] / zsh / aliases / git-extras.zsh
1 #compdef git
2 # ------------------------------------------------------------------------------
3 # Description
4 # -----------
5 #
6 # Completion script for git-extras (http://github.com/visionmedia/git-extras).
7 #
8 # ------------------------------------------------------------------------------
9 # Authors
10 # -------
11 #
12 # * Alexis GRIMALDI (https://github.com/agrimaldi)
13 #
14 # ------------------------------------------------------------------------------
15 # Inspirations
16 # -----------
17 #
18 # * git-extras (http://github.com/visionmedia/git-extras)
19 # * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
20 #
21 # ------------------------------------------------------------------------------
22
23
24 __git_command_successful () {
25 if (( ${#pipestatus:#0} > 0 )); then
26 _message 'not a git repository'
27 return 1
28 fi
29 return 0
30 }
31
32
33 __git_tag_names() {
34 local expl
35 declare -a tag_names
36 tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
37 __git_command_successful || return
38 _wanted tag-names expl tag-name compadd $* - $tag_names
39 }
40
41
42 __git_branch_names() {
43 local expl
44 declare -a branch_names
45 branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
46 __git_command_successful || return
47 _wanted branch-names expl branch-name compadd $* - $branch_names
48 }
49
50
51 __git_feature_branch_names() {
52 local expl
53 declare -a branch_names
54 branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
55 __git_command_successful || return
56 _wanted branch-names expl branch-name compadd $* - $branch_names
57 }
58
59
60 __git_refactor_branch_names() {
61 local expl
62 declare -a branch_names
63 branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
64 __git_command_successful || return
65 _wanted branch-names expl branch-name compadd $* - $branch_names
66 }
67
68
69 __git_bug_branch_names() {
70 local expl
71 declare -a branch_names
72 branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
73 __git_command_successful || return
74 _wanted branch-names expl branch-name compadd $* - $branch_names
75 }
76
77
78 __git_submodule_names() {
79 local expl
80 declare -a submodule_names
81 submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
82 __git_command_successful || return
83 _wanted submodule-names expl submodule-name compadd $* - $submodule_names
84 }
85
86
87 __git_author_names() {
88 local expl
89 declare -a author_names
Reading blob failed.