Debian Codegraph @

data/share/zsh/site-functions/_pybugz

raw
1 #compdef bugz
2 # Copyright 2009 Ingmar Vanhassel <[email protected]>
3 # vim: set et sw=2 sts=2 ts=2 ft=zsh :
4
5 _bugz() {
6 local -a _bugz_options _bugz_commands
7 local cmd
8
9 _bugz_options=(
10 '(-b --base)'{-b,--base}'[bugzilla base URL]:bugzilla url: '
11 '(-u --user)'{-u,--user}'[user name (if required)]:user name:_users'
12 '(-p --password)'{-p,--password}'[password (if required)]:password: '
13 '--columns[number of columns to use when displaying output]:number: '
14 '--skip-auth[do not authenticate]'
15 '(-q --quiet)'{-q,--quiet}'[do not display status messages]'
16 )
17 _bugz_commands=(
18 'attach:attach file to a bug'
19 'attachment:get an attachment from bugzilla'
20 'get:get a bug from bugzilla'
21 'help:display subcommands'
22 'modify:modify a bug (eg. post a comment)'
23 'post:post a new bug into bugzilla'
24 'search:search for bugs in bugzilla'
25 )
26
27 for (( i=1; i <= ${CURRENT}; i++ )); do
28 cmd=${_bugz_commands[(r)${words[${i}]}:*]%%:*}
29 (( ${#cmd} )) && break
30 done
31
32 if (( ${#cmd} )); then
33 local curcontext="${curcontext%:*:*}:bugz-${cmd}:"
34
35 while [[ ${words[1]} != ${cmd} ]]; do
36 (( CURRENT-- ))
37 shift words
38 done
39
40 _call_function ret _bugz_cmd_${cmd}
41 return ret
42 else
43 _arguments -s : $_bugz_options
44 _describe -t commands 'commands' _bugz_commands
45 fi
46 }
47
48 (( ${+functions[_bugz_cmd_attach]} )) ||
49 _bugz_cmd_attach()
50 {
51 _arguments -s : \
52 '(--content_type= -c)'{--content_type=,-c}'[mimetype of the file]:MIME-Type:_mime_types' \
53 '(--title= -t)'{--title=,-t}'[a short description of the attachment]:title: ' \
54 '(--description= -d)'{--description=,-d}'[a long description of the attachment]:description: ' \
55 '(--bigfile)'{--bigfile}'[the attachment is a big file]:bigfile: ' \
56 '--help[show help message and exit]'
57 }
58
59 (( ${+functions[_bugz_cmd_attachment]} )) ||
60 _bugz_cmd_attachment()
61 {
62 _arguments -s : \
63 '--help[show help message and exit]' \
64 '(--view -v)'{--view,-v}'[print attachment rather than save]'
65 }
66
67
68 (( ${+functions[_bugz_cmd_get]} )) ||
69 _bugz_cmd_get()
70 {
71 _arguments -s : \
72 '--help[show help message and exit]' \
73 '(--no-comments -n)'{--no-comments,-n}'[do not show comments]'
74 }
75
76 (( ${+functions[_bugz_cmd_modify]} )) ||
77 _bugz_cmd_modify()
78 {
79 _arguments -s : \
80 '--add-blocked=[add a bug to the blocked list]:bug: ' \
81 '--add-dependson=[add a bug to the depends list]:bug: ' \
82 '--add-cc=[add an email to CC list]:email: ' \
83 '(--assigned-to= -a)'{--assigned-to=,-a}'[assign bug to someone other than the default assignee]:assignee: ' \
84 '(--comment= -c)'{--comment=,-c}'[add comment to bug]:Comment: ' \
85 '(--comment-editor -C)'{--comment-editor,-C}'[add comment via default EDITOR]' \
86 '(--comment-from= -F)'{--comment-from=,-F}'[add comment from file]:file:_files' \
87 '(--duplicate= -d)'{--duplicate=,-d}'[mark bug as a duplicate of bug number]:bug: ' \
88 '--fixed[mark bug as RESOLVED, FIXED]' \
89 '--help[show help message and exit]' \
90 '--invalid[mark bug as RESOLVED, INVALID]' \
91 '(--keywords= -k)'{--keywords=,-k}'[list of bugzilla keywords]:keywords: ' \
92 '--priority=[set the priority field of the bug]:priority: ' \
93 '(--resolution= -r)'{--resolution=,-r}'[set new resolution (only if status = RESOLVED)]' \
94 '--remove-cc=[remove an email from the CC list]:email: ' \
95 '--remove-dependson=[remove a bug from the depends list]:bug: ' \
96 '--remove-blocked=[remove a bug from the blocked list]:bug: ' \
97 '(--severity= -S)'{--severity=,-S}'[set severity of the bug]:severity: ' \
98 '(--status -s=)'{--status=,-s}'[set new status of bug (eg. RESOLVED)]:status: ' \
99 '(--title= -t)'{--title=,-t}'[set title of the bug]:title: ' \
100 '(--url= -U)'{--url=,-u}'[set URL field of the bug]:URL: ' \
101 '(--whiteboard= -w)'{--whiteboard=,-w}'[set status whiteboard]:status whiteboard: '
102 }
103
104 (( ${+functions[_bugz_cmd_post]} )) ||
105 _bugz_cmd_post()
106 {
107 _arguments -s : \
108 '(--assigned-to= -a)'{--assigned-to=,-a}'[assign bug to someone other than the default assignee]:assignee: ' \
109 '--batch[work in batch mode, non-interactively]' \
110 '--blocked[add a list of blocker bugs]:blockers: ' \
111 '--cc=[add a list of emails to cc list]:email(s): ' \
112 '--commenter[email of a commenter]:email: ' \
113 '--depends-on[add a list of bug dependencies]:dependencies: ' \
114 '(--description= -d)'{--description=,-d}'[description of the bug]:description: ' \
115 '(--description-from= -F)'{--description-from=,-f}'[description from contents of a file]:file:_files' \
116 '--help[show help message and exit]' \
117 '(--keywords= -k)'{--keywords=,-k}'[list of bugzilla keywords]:keywords: ' \
118 '(--append-command)--no-append-command[do not append command output]' \
119 '(--title= -t)'{--title=,-t}'[title of your bug]:title: ' \
120 '(--url= -U)'{--url=,-U}'[URL associated with the bug]:url: ' \
121 '--priority[priority of this bug]:priority: ' \
122 '--severity[severity of this bug]:severity: '
123 }
124
125 (( ${+functions[_bugz_cmd_search]} )) ||
126 _bugz_cmd_search()
127 {
128 # TODO --component,--status,--product,--priority can be specified multiple times
129 _arguments -s : \
130 '(--assigned-to= -a)'{--assigned-to=,-a}'[the email adress the bug is assigned to]:email: ' \
131 '--cc=[restrict by CC email address]:email: ' \
132 '(--comments -c)'{--comments,-c}'[search comments instead of title]:comment: ' \
133 '(--component= -C)'{--component=,-C}'[restrict by component]:component: ' \
134 '--help[show help message and exit]' \
135 '(--keywords= -k)'{--keywords=,-k}'[bug keywords]:keywords: ' \
136 '--severity=[restrict by severity]:severity: ' \
137 '--show-status[show bug status]' \
138 '(--status= -s)'{--status=,-s}'[bug status]:status: ' \
139 '(--order= -o)'{--order=,-o}'[sort by]:order:((number\:"bug number" assignee\:"assignee field" importance\:"importance field" date\:"last changed"))' \
140 '--priority=[restrict by priority]:priority: ' \
141 '--product=[restrict by product]:product: ' \
142 '(--reporter= -r)'{--reporter=,-r}'[email of the reporter]:email: ' \
143 '(--whiteboard= -w)'{--whiteboard=,-w}'[status whiteboard]:status whiteboard: '
144 }
145
146 _bugz
147