1#compdef bts 2 3local expl first=1 4 5_arguments -A "-*" \ 6 '(-o --offline)'{-o,--offline}'[use cached bugs]' \ 7 '(--online --no-offline)'{--online,--no-offline}'[do not use cached bugs]' \ 8 '(--cache --no-cache)--cache[cache new versions of pages]' \ 9 '(--cache --no-cache)--no-cache[do not cache new versions of pages]' \ 10 '--cache-mode=:cache mode:(min mbox full)' \ 11 '--cache-delay=:seconds:' \ 12 '--mbox[open a mail reader to read the corresponding mbox]' \ 13 '--mailreader=:reader:' \ 14 '(-f --force-refresh)'{-f,--force-refresh}'[download bug report even if unchanged]' \ 15 '-no-force-refresh[do not force refresh]' \ 16 '(-q --quiet)*'{-q,--quiet}'[only display info about newly cached pages]' \ 17 '(--no-conf --noconf)*'{--no-conf,--noconf}'[do not read any config files]' \ 18 '*:subcommand and args:->subcmds' && return 0 19 20compset -N '-[^0-9]#' && first=0 21compset -N '[,.]' && first=0 22[[ $first -eq 0 ]] || compset -n 2 23 24if [[ CURRENT -eq 1 ]]; then 25 _wanted cmd expl 'bts command' compadd show bugs close reopen retitle \ 26 reassign merge unmerge tag tags severity forwarded notforwarded help \ 27 clone submitter found notfound block unblock user usertag usertags \ 28 package owner noowner reportspam cache cleancache claim unclaim \ 29 subscribe unsubscribe fixed notfixed affects 30 return 31fi 32 33case "$words[1]" in 34 (close|unmerge|notforwarded|noowner|reportspam) 35 if [[ CURRENT -eq 2 ]]; then 36 _message -e bugnum 'bug number' 37 else 38 _wanted sep expl 'separator' compadd -S ' ' , . 39 fi 40 ;; 41 (show|bugs) 42 if [[ CURRENT -eq 2 ]]; then 43 _wanted package expl 'package' _deb_packages avail 44 _wanted maintainer expl 'package maintainer' compadd $DEBEMAIL 45 fi 46 _wanted sep expl 'separator' compadd -S ' ' , . 47 ;; 48 reopen) 49 if [[ CURRENT -eq 2 ]]; then 50 _message -e bugnum 'bug number' 51 elif [[ CURRENT -eq 3 ]]; then 52 _wanted submitter expl 'new submitter' compadd $DEBEMAIL 53 else 54 _wanted sep expl 'separator' compadd -S ' ' , . 55 fi 56 ;; 57 retitle) 58 if [[ CURRENT -eq 2 ]]; then 59 _message -e bugnum 'bug number' 60 elif [[ CURRENT -eq 3 ]]; then 61 _message -e submitter 'new title' 62 else 63 _wanted sep expl 'separator' compadd -S ' ' , . 64 fi 65 ;; 66 reassign) 67 if [[ CURRENT -eq 2 ]]; then 68 _message -e bugnum 'bug number' 69 elif [[ CURRENT -eq 3 ]]; then 70 _wanted submitter expl 'new package' _deb_packages avail 71 else 72 _wanted sep expl 'separator' compadd -S ' ' , . 73 fi 74 ;; 75 merge) 76 _message -e bugnum 'bug number' 77 if [[ CURRENT -gt 2 ]]; then 78 _wanted sep expl 'separator' compadd -S ' ' , . 79 fi 80 ;; 81 tags#) 82 if [[ CURRENT -eq 2 ]]; then 83 _message -e bugnum 'bug number' 84 elif [[ CURRENT -eq 3 ]]; then 85 _wanted operator expl 'operator' compadd - '+' '-' '=' 86 elif [[ CURRENT -eq 4 ]]; then 87 _wanted tag expl 'tag' \ 88 compadd patch wontfix moreinfo unreproducible help pending \ 89 fixed security upstream confirmed fixed-upstream \ 90 fixed-in-experimental d-i ipv6 lfs l10n potato woody sarge \ 91 sarge-ignore etch etch-ignore lenny lenny-ignore squeeze \ 92 squeeze-ignore wheezy wheezy-ignore sid experimental 93 else 94 _wanted tag expl 'tag' \ 95 compadd patch wontfix moreinfo unreproducible help pending \ 96 fixed security upstream confirmed fixed-upstream \ 97 fixed-in-experimental d-i ipv6 lfs l10n potato woody sarge \ 98 sarge-ignore etch etch-ignore lenny lenny-ignore squeeze \ 99 squeeze-ignore wheezy wheezy-ignore sid experimental 100 _wanted sep expl 'separator' compadd -S ' ' , . 101 fi 102 ;; 103 severity) 104 if [[ CURRENT -eq 2 ]]; then 105 _message -e bugnum 'bug number' 106 elif [[ CURRENT -eq 3 ]]; then 107 _wanted severity expl 'severity' \ 108 compadd wishlist minor normal serious important critical grave 109 else 110 _wanted sep expl 'separator' compadd -S ' ' , . 111 fi 112 ;; 113 forwarded) 114 if [[ CURRENT -eq 2 ]]; then 115 _message -e bugnum 'bug number' 116 elif [[ CURRENT -eq 3 ]]; then 117 _wanted upstream expl 'upstream email' _email_addresses -c 118 else 119 _wanted sep expl 'separator' compadd -S ' ' , . 120 fi 121 ;; 122 (clone) 123 if [[ CURRENT -eq 2 ]]; then 124 _message -e bugnum 'bug number' 125 elif [[ CURRENT -eq 3 || -prefix [-] ]]; then 126 _wanted newid expl 'new ID' compadd -- -{1..9} 127 else 128 _wanted sep expl 'separator' compadd -S ' ' , . 129 fi 130 ;; 131 (submitter) 132 if [[ CURRENT -eq 2 ]]; then 133 _message -e bugnum 'bug number' 134 else 135 _alternative \ 136 'bugnum:bug number:' \ 137 'email:email address:_email_addresses -c' \ 138 'bang:bang:compadd \!' 139 fi 140 ;; 141 (owner|subscribe|unsubscribe) 142 if [[ CURRENT -eq 2 ]]; then 143 _message -e bugnum 'bug number' 144 elif [[ CURRENT -eq 3 ]]; then 145 _alternative \ 146 'email:email address:_email_addresses -c' \ 147 'bang:bang:compadd \!' 148 else 149 _wanted sep expl 'separator' compadd -S ' ' , . 150 fi 151 ;; 152 (found|notfound|fixed|notfixed) 153 if [[ CURRENT -eq 2 ]]; then 154 _message -e bugnum 'bug number' 155 elif [[ CURRENT -eq 3 ]]; then 156 _message -e version 'version' 157 else 158 _wanted sep expl 'separator' compadd -S ' ' , . 159 fi 160 ;; 161 (block|unblock) 162 if [[ CURRENT -eq 2 ]]; then 163 _message -e bugnum 'bug number' 164 elif [[ CURRENT -eq 3 ]]; then 165 _wanted prep expl 'preposition' compadd by with 166 else 167 _alternative \ 168 'bugnum:bug number:' \ 169 'separator:separator:compadd -S " " , .' 170 fi 171 ;; 172 (user) 173 if [[ CURRENT -eq 2 ]]; then 174 _wanted upstream expl 'user email for usertags' _email_addresses -c 175 else 176 _wanted sep expl 'separator' compadd -S ' ' , . 177 fi 178 ;; 179 (usertags#) 180 if [[ CURRENT -eq 2 ]]; then 181 _message -e bugnum 'bug number' 182 elif [[ CURRENT -eq 3 ]]; then 183 _wanted operator expl 'operator' compadd - '+' '-' '=' 184 elif [[ CURRENT -eq 4 ]]; then 185 _message -e usertag 'user tag' 186 else 187 _message -e usertag 'user tag' 188 _wanted sep expl 'separator' compadd -S ' ' , . 189 fi 190 ;; 191 (package) 192 if [[ CURRENT -eq 2 ]]; then 193 _wanted package expl 'package' _deb_packages avail 194 else 195 _wanted sep expl 'separator' compadd -S ' ' , . 196 fi 197 ;; 198 (cache) 199 _alternative \ 200 'package:package:_deb_packages avail' \ 201 'email:email address:_email_addresses -c' \ 202 'rc:rc:compadd release-critical' 203 ;; 204 (cleancache) 205 _alternative \ 206 'package:package:_deb_packages avail' \ 207 'email:email address:_email_addresses -c' \ 208 'all:all:compadd ALL' 209 ;; 210 (claim|unclaim) 211 if [[ CURRENT -eq 2 ]]; then 212 _message -e bugnum 'bug number' 213 elif [[ CURRENT -eq 3 ]]; then 214 _alternative \ 215 'email:email address:_email_addresses -c' \ 216 'separator:separator:compadd -S " " , .' 217 else 218 _wanted sep expl 'separator' compadd -S ' ' , . 219 fi 220 ;; 221 (affects) 222 if [[ CURRENT -eq 2 ]]; then 223 _message -e bugnum 'bug number' 224 elif [[ CURRENT -eq 3 ]]; then 225 _wanted operator expl 'operator' compadd - '+' '-' '=' 226 else 227 _wanted package expl 'package' _deb_packages avail 228 fi 229 ;; 230 help) 231 ;& 232 *) _wanted sep expl 'separator' compadd -S ' ' , . 233 ;; 234esac 235