1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
|
#compdef dpt
_dpt_conf() {
for f in ~/.dpt.conf ~/.config/dpt.conf; do
if [ -r "$f" ]; then
. "$f"
fi
done
}
_dpt() {
_arguments \
'(-h --help)'{-h,--help}'[show help]' \
'*::dpt commands:_dpt_commands'
}
_dpt_commands() {
local -a dpt_commands
typeset -gA _dpt_alias_list
dpt_commands=(
'cd:change directory to a package working directory'
'checkout:work on pkg-perl package'
'ci-failures:query ci.debian.net for autopkgtest failures'
'clean-mr-repos:remove local repos which are gone from salsa.debian.org'
'co:alias for checkout'
'dch-note:add notes/TODO items to debian/changelog'
'debian-upstream:create debian/upstream/metadata file from META.{json,yml}'
'fixup:apply some automatic fixes to packaging'
'forward:forward a bug or a patch upstream'
'gc:swipe pkg-perl working directories'
'gen-itp:create ITP bug template'
'get-ubuntu-packages:list Ubuntu packages maintained by the group'
'github-oauth:generate GitHub OAuth2 token'
'import-orig:"gbp import-orig" wrapper with upstream tracking support'
'invite-github:invite someone to GitHub team'
'lp-mass-subscribe:subscribe the Ubuntu group to a list of packages'
'missing-pristine-tar:remedy missing pristine-tar information'
'missing-upload:incorporate package uploads not done from Git'
'missing-upstream:remedy missing upstream branch/tags'
'new-upstream:list packages with newer upstream versions'
'never-uploaded:list packages in Git which are not in the archive'
'packagecheck:various package consistency checks'
'prepare:prepare yourself and a source directory before working on a package'
'push:push relevant refs to "origin" remote'
'ready-for-upload:list packages in Git which need an upload'
'rename-uploader:mass-change of uploaded name/email'
'salsa:manage repositories and members on salsa.debian.org'
'takeover:take over package maintenance'
'upstreamvcs:add upstream Git repository as git remote upstreamvcs'
'uscan:tiny wrapper around uscan and gbp-import-orig'
)
_dpt_alias_list=(
co checkout
upstream-repo upstreamvcs
)
if ((CURRENT == 1)); then
_describe -t commands 'dpt subcommands' dpt_commands
else
local curcontext="$curcontext"
cmd=$words[1]
[[ -z $_dpt_alias_list[$cmd] ]] || cmd=$_dpt_alias_list[$cmd]
if (( $+functions[_dpt_$cmd] )); then
_dpt_$cmd
else
_message -e "no completion for subcommand $cmd"
fi
fi
}
_dpt_cd() {
_dpt_conf
_arguments \
'*:package name:_files -W ${DPT_PACKAGES:-$HOME} -/'
}
_dpt_ci-failures() {
_arguments \
'-d+[Distribution, defaults to unstable]:distribution:(testing unstable)' \
'-A+[Architecture, defaults to amd64]:architecture (currently only amd64):_deb_architectures' \
'-a[Show more ("all") results (slow). By default only packages matching /perl/ and the latest versions are shown.]' \
'-b[Additionally show RC bugs for the found packages.]' \
'-I[Additionally show the run id for the last run (suitable for retrying a test via the ci.debian.net API.)]' \
'-h[Show help]' \
'-m[Show full manpage]'
}
_dpt_clean-mr-repos() {
_arguments \
'--help[Show help]' \
'--force[Actually remove the local repositories. By default they are only listed.]'
}
_dpt_checkout() {
_dpt_conf
_arguments \
'*:package name:_files -W ${DPT_PACKAGES:-$HOME} -/'
}
_dpt_dch-note() {
_arguments \
'(--ignore --ignore-version)'{--ignore,--ignore-version}'[Add an "IGNORE-VERSION: version" comment.]:comment' \
'(--waits --waits-for)'{--waits,--waits-for}'[Add a "WAITS-FOR: package version" comment.]:package name::package version:' \
'--unreleased[Change distribution in debian/changelog to "unreleased"]'
}
_dpt_debian-upstream() {
# no arguments
_message -e "no options or arguments for dpt $words[1]"
}
_dpt_fixup() {
# no arguments
_message -e "no options or arguments for dpt $words[1]"
}
_dpt_forward() {
_arguments \
'(--dist -d)'{--dist,-d}'[distribution name, if not found automatically]:distribution name}' \
"--force[don't abort if the bug/patch is already forwarded]" \
'(--mode -m)'{--mode,-m}'[mode: bug or patch; rarely needed]:mode:(bug patch)' \
'--offline-test[skip operations that require network]' \
'--ticket[add to existing ticket instead of opening a new one]:ticket number:' \
'(--tracker -t)'{--tracker,-t}'[tracker name: "cpan" or "github", if not found automatically]:tracker name:(cpan github)' \
'(--tracker-url -u)'{--tracker-url,-u}'[tracker URL, mandatory for "github" tracker]:tracker URL:_urls' \
'--use-mail[send submission via email]' \
'--mailto[email address to send submission to]' \
'--fallback[fallback to creating bug reports if pull request fails]' \
'*:Debian bug number or path to patch (or both):_files'
}
_dpt_gc() {
_arguments \
'-h[Display usage information.]' \
'-p[Run in parallel, utilizing all CPUs.]' \
'-s[Display statistics about disk usage before and after garbage collection.]' \
"-v[Verbose operation. Let git-gc(1) emit progress messages. Doesn't display per-repository stats when -p is used.]"
}
_dpt_gen-itp() {
# no arguments
_message -e "no options or arguments for dpt $words[1]"
}
_dpt_get-ubuntu-packages() {
# no arguments
_message -e "no options or arguments for dpt $words[1]"
}
_dpt_github-oauth() {
_arguments \
'*::note-text (optional, short note associated with the token):'
}
_dpt_import-orig() {
_arguments \
'*::tarball (optional, default\: --uscan):'
}
_dpt_invite-github() {
_arguments \
'--role=[set role for user]:role:(admin member)' \
'--force[change role of an existing member]' \
'*:github-username:'
}
_dpt_lp-mass-subscribe() {
# no arguments
_message -e "no options or arguments for dpt $words[1]"
}
_dpt_missing-pristine-tar() {
# no arguments
_message -e "no options or arguments for dpt $words[1]"
}
# based on /usr/share/zsh/functions/Completion/Unix/_git
__git_tags () {
local expl
declare -a tags
tags=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
_wanted tags expl tag compadd "$@" -a - tags
}
_dpt_missing-upload() {
_arguments \
'1:base tag:__git_tags' \
'2:new version'
}
_dpt_missing-upstream() {
_arguments \
'--check-only[Only report missing tags, do not try to download sources.]' \
"--skip-missing-snapshots[Don't error out if tarballs are not found on snapshot.debian.org]"
}
_dpt_new-upstream() {
_arguments \
'(-h --help)'{-h,--help}'[show help]' \
'(-m --man)'{-m,--man}'[show manpage]' \
'(-l --limit)'{--limit,-l}'[packages list file]:packages list file:_files'
}
_dpt_never-uploaded() {
_arguments \
'(-h --help)'{-h,--help}'[show help]' \
'(-m --man)'{-m,--man}'[show manpage]' \
}
_dpt_ready-for-upload() {
_arguments \
'(-h --help)'{-h,--help}'[show help]' \
'(-m --man)'{-m,--man}'[show manpage]' \
}
_dpt_packagecheck() {
_arguments \
+ '(act on)' \
'-c[only check current directory]' \
'-p[check specific package]:top of directory tree:' \
+ '(commit options)' \
'-a[commit changes with "mr commit"]' \
'-n[do not commit changes with "mr commit"]' \
+ 'check options' \
'-A[run all checks]' \
'-V[add/fix Vcs-* fields]' \
'-H[add Homepage field]' \
'-M[fix Maintainer field]' \
'-D[add add "${misc:Depends}" to Depends]' \
'-d[fix Format-Specification]' \
'-P[remove ancient perl version constraints]' \
'-O[replace "perl-modules" with "perl"]' \
'-W[use MetaCPAN URLs]' \
'-C[If -W is given, create debian/watch if it does not exist]' \
'-R[fixups for debian/rules]' \
'-Q[add debian/README.source if the package uses quilt]'
}
_dpt_prepare() {
# no arguments
_message -e "no options or arguments for dpt $words[1]"
}
_dpt_push() {
_arguments \
'*::git arguments (optional):'
}
_dpt_rename-uploader() {
_arguments \
'1:full name' \
'2:old email address' \
'3:new email address'
}
_dpt_salsa() {
_arguments \
'--help[show short help]' \
'--man[show full manpage]' \
'*::dpt salsa commands:_dpt_salsa_commands'
}
_dpt_salsa_commands() {
local -a dpt_salsa_repo_commands dpt_salsa_user_commands dpt_salsa_other_commands
dpt_salsa_repo_commands=(
'pushrepo:create and configure repo on salsa and push local repo'
'createrepo:create and configure new empty repo on salsa'
'configurerepo:configure repo on salsa'
'changerepo:change name or description of a repo on salsa'
'deleterepo:delete a repo on salsa'
'listrepos:list repos on salsa'
'kgb:enable/disable kgb webhook for repo'
'toattic:move repo to attic subgroup'
'fromattic:resurrect repo from attic subgroup'
)
dpt_salsa_user_commands=(
'adduser:add user to group'
'removeuser:remove user from group'
'changeuser:change access level of user in group'
'listmembers:list all group members'
)
dpt_salsa_other_commands=(
'mrconfig:helper for handling all repos with mr(1)'
'current_user:information about current user'
'help:same as --help'
'version:returns version of Gitlab running on salsa'
)
if ((CURRENT == 1)); then
_describe -t salsacommands \
'dpt salsa subcommands' dpt_salsa_repo_commands \
-- \
dpt_salsa_user_commands \
-- \
dpt_salsa_other_commands
else
local curcontext="$curcontext"
cmd=$words[1]
if (( $+functions[_dpt_salsa_$cmd] )); then
_dpt_salsa_$cmd
else
_message -e "no completion for dpt-salsa subcommand $cmd"
fi
fi
}
_dpt_salsa_pushrepo() {
# no arguments
_message -e "no options or arguments for dpt salsa $words[1]"
}
_dpt_salsa_createrepo() {
_arguments \
'1:repository name'
}
_dpt_salsa_configurerepo() {
_arguments \
- 'one' \
'1:repositoryid|repositoryname' \
- 'all' \
'--all[configure all repos]' \
'--attic[configure attic repos]' \
'--verbose[enable output]' \
'(-j --parallel)'{-j,--parallel}'=[run N parallel processes]:count:'
}
_dpt_salsa_changerepo() {
_arguments \
'1:repositoryid|repositoryname' \
'2:property:(name description)' \
'3:new value'
}
_dpt_salsa_deleterepo() {
_arguments \
'1:repositoryid|repositoryname'
}
_dpt_salsa_listrepos() {
_arguments \
'--json[output result as JSON]' \
'--attic[list repos in attic]'
}
_dpt_salsa_kgb() {
_arguments \
+ '(operation)' \
'--on[turn on KGB notfications]' \
'--off[turn off KGB notfications]' \
+ 'one' \
'(all)1:repositoryid|repositoryname' \
+ 'all' \
'(one)--all[configure all repos]' \
'(one)--attic[configure attic repos]'
}
_dpt_salsa_toattic() {
_arguments \
'*:repositoryid|repositoryname'
}
_dpt_salsa_fromattic() {
_arguments \
'*:repositoryid|repositoryname'
}
_dpt_salsa_adduser() {
_arguments \
'1:username|userid' \
'2::access level (optional, default\: maintainer):(no_access guest reporter developer maintainer owner)'
}
_dpt_salsa_removeuser() {
_arguments \
'1:username|userid'
}
_dpt_salsa_changeuser() {
_arguments \
'1:access level:(no_access guest reporter developer maintainer owner)' \
+ '(who)' \
'2:username|userid' \
'--all[all group members]'
}
_dpt_salsa_listmembers() {
_arguments \
'--json[output result as JSON]'
}
_dpt_salsa_mrconfig() {
_arguments \
'(-j --parallel)'{-j,--parallel}'=[run N parallel processes]:count:' \
}
_dpt_salsa_current_user() {
_arguments \
'--json[output result as JSON]'
}
_dpt_salsa_help() {
# no arguments
_message -e "no options or arguments for dpt salsa $words[1]"
}
_dpt_salsa_version() {
_arguments \
'--json[output result as JSON]'
}
_dpt_takeover() {
_arguments \
'-t[top directory (mandatory, unless DPT_PACKAGES is set)]:top directory:_files -/' \
'-g[URL of existing Git repo]:previous Git repo:_urls' \
'-n[local operation only, do not push to salsa]' \
'-h[show help]' \
+ '(message)' \
'-m[URL to message with takeover request/permission (conflicts with -a)]:URL:_urls' \
'-a[RFA/ITA bug number (conflicts with -m)]:bug number:_debbugs_bugnumber' \
+ '(pkg)' \
'*:packagename:_deb_packages source'
}
_dpt_upstreamvcs() {
_arguments \
"-g[Don't create debian/upstream/metadata.]" \
'-u[Update the URL of the git remote "upstreamvcs".]'
}
_dpt_uscan() {
# no arguments
_message -e "no options or arguments for dpt $words[1]"
}
_dpt "$@"
|