be65adc6c364e842307c7b4e8da30f0162b629f0
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- GitHub <noreply@github.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
2index afc1679ccb2194df8efba590986e651b4fe1ae6a..ef6c359881307da3f02bef5b24654c418f8e1058 100644
3--- a/plugins/git-extras/git-extras.plugin.zsh
4+++ b/plugins/git-extras/git-extras.plugin.zsh
5@@ -47,6 +47,14 @@ __gitex_commits() {
6 _describe -t commits commit commits && ret=0
7 }
8
9+__gitex_remote_names() {
10+ local expl
11+ declare -a remote_names
12+ remote_names=(${(f)"$(_call_program remotes git remote 2>/dev/null)"})
13+ __git_command_successful || return
14+ _wanted remote-names expl remote-name compadd $* - $remote_names
15+}
16+
17 __gitex_tag_names() {
18 local expl
19 declare -a tag_names
20@@ -69,7 +77,11 @@ __gitex_specific_branch_names() {
21 declare -a branch_names
22 branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
23 __git_command_successful || return
24- _wanted branch-names expl branch-name compadd $* - $branch_names
25+ _wanted branch-names expl branch-name compadd - $branch_names
26+}
27+
28+__gitex_chore_branch_names() {
29+ __gitex_specific_branch_names 'chore'
30 }
31
32 __gitex_feature_branch_names() {
33@@ -102,6 +114,11 @@ __gitex_author_names() {
34 }
35
36 # subcommands
37+_git-authors() {
38+ _arguments -C \
39+ '(--list -l)'{--list,-l}'[show authors]' \
40+ '--no-email[without email]' \
41+}
42
43 _git-bug() {
44 local curcontext=$curcontext state line ret=1
45@@ -126,8 +143,16 @@ _git-bug() {
46 _arguments -C \
47 ':branch-name:__gitex_bug_branch_names'
48 ;;
49+ -r|--remote )
50+ _arguments -C \
51+ ':remote-name:__gitex_remote_names'
52+ ;;
53 esac
54+ return 0
55 esac
56+
57+ _arguments \
58+ '(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
59 }
60
61
62@@ -136,6 +161,40 @@ _git-changelog() {
63 '(-l --list)'{-l,--list}'[list commits]' \
64 }
65
66+_git-chore() {
67+ local curcontext=$curcontext state line ret=1
68+ declare -A opt_args
69+
70+ _arguments -C \
71+ ': :->command' \
72+ '*:: :->option-or-argument' && ret=0
73+
74+ case $state in
75+ (command)
76+ declare -a commands
77+ commands=(
78+ 'finish:merge and delete the chore branch'
79+ )
80+ _describe -t commands command commands && ret=0
81+ ;;
82+ (option-or-argument)
83+ curcontext=${curcontext%:*}-$line[1]:
84+ case $line[1] in
85+ (finish)
86+ _arguments -C \
87+ ':branch-name:__gitex_chore_branch_names'
88+ ;;
89+ -r|--remote )
90+ _arguments -C \
91+ ':remote-name:__gitex_remote_names'
92+ ;;
93+ esac
94+ return 0
95+ esac
96+
97+ _arguments \
98+ '(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
99+}
100
101
102 _git-contrib() {
103@@ -149,6 +208,27 @@ _git-count() {
104 '--all[detailed commit count]'