Hi,
Just sharing my fedpkg(1) completion for zsh :-) Put this file
somewhere in your $fpath as usual.
--
Regards,--
Sir Raorn. --- http://thousandsofhate.blogspot.com/
#compdef fedpkg
(( $+functions[_fedpkg_targets] )) ||
_fedpkg_targets()
{
local expl
_wanted koji-targets expl 'target' compadd \
${${(f)$(_call_program koji-targets koji list-targets --quiet
2/dev/null)}%% *}
}
(( $+functions[_fedpkg_arches] )) ||
_fedpkg_arches()
{
local expl
local -a arches
arches=( /etc/mock/[^-]##-[^-]##-[^-]##.cfg )
_wanted mock-arches expl 'arch' compadd \
${(u)${arches#/etc/mock/[^-]##-[^-]##-}%.cfg}
}
(( $+functions[_fedpkg_packages] )) ||
_fedpkg_packages()
{
local expl
_wanted repo-packages expl 'package' compadd \
${${(fu)$(repoquery -Cs -- $words[CURRENT]*)}%-[^-]##-[^-]##.src.rpm}
}
(( $+functions[_fedpkg_branches] )) ||
_fedpkg_branches()
{
local expl
local -a git_opts
local -a branches
(( ${words[(I)--path]} ))
git_opts=( --git-dir ${words[${words[(i)--path]}+1]} )
branches=(${${(f)$(git $git_opts for-each-ref --format='%(refname)'
refs/heads 2/dev/null)}#refs/heads/})
branches+=(${${(f)$(git $git_opts for-each-ref --format='%(refname)'
refs/remotes 2/dev/null)}##refs/remotes/*/})
_wanted branch-names expl 'branch-name' compadd \
${(u)branches}
}
(( $+functions[_fedpkg-help] )) ||
_fedpkg-help () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]'
}
(( $+functions[_fedpkg-build] )) ||
_fedpkg-build () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]' \
'--arches[build for specific arches]:*:arch:_fedpkg_arches' \
'--md5[use md5 checksums]' \
'--nowait[on'\''t wait on build]' \
'--target[define build target to build into]:target:_fedpkg_targets' \
'--background[run the build at a low priority]' \
'--skip-tag[do not attempt to tag package]' \
'--scratch[rerform a scratch build]' \
'--srpm[build from an srpm]::srpm:_files -g *.src.rpm'
}
(( $+functions[_fedpkg-chain-build] )) ||
_fedpkg-chain-build () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]' \
'--arches[build for specific arches]:*:arch:_fedpkg_arches' \
'--md5[use md5 checksums]' \
'--nowait[on'\''t wait on build]' \
'--target[define build target to build into]:target:_fedpkg_targets' \
'--background[run the build at a low priority]' \
'*:package:_fedpkg_packages'
}
(( $+functions[_fedpkg-clean] )) ||
_fedpkg-clean () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]' \
'(-n --dry-run)'{-n,--dry-run}'[perform a dry-run]' \
'-x[do not follow .gitignore rules]'
}
(( $+functions[_fedpkg-clog] )) ||
_fedpkg-clog () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]' \
'--raw[generate a more raw clog without twiddling the contents]'
}
(( $+functions[_fedpkg-clone] )) ||
_fedpkg-clone () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]' \
'(-B --branches)'{-B,--branches}'[do an old style checkout with subdirs for
branches]' \
'(-b --branch)'{-b,--branch}'[check out a specific
branch]:branch:_fedpkg_branches' \
'(-a --anonymous)'{-a,--anonymous}'[check out a module anonymously]' \
':package:_fedpkg_packages'
}
(( $+functions[_fedpkg-commit] )) ||
_fedpkg-commit () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]' \
'(-c --clog)'{-c,--clog}'[generate the commit message from the %changelog
section]' \
'--raw[make the clog raw]' \
'(-t --tag)'{-t,--tag}'[create a tag for this commit]' \
'(-m --message)'{-m,--message}'[use the given commit message]:message' \
'(-F --file)'{-F,--file}'[take the commit message from the given
file]:file:_files' \
'(-p --push)'{-p,--push}'[commit and push as one action]' \
'*:file:_files'
}
(( $+functions[_fedpkg-compile] )) ||
_fedpkg-compile () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]' \
'--builddir[define an alternate builddir]:builddir:_files -/' \
'--arch[prep for a specific arch]:arch:_fedpkg_arches' \
'--short-circuit[short-circuit compile]'
}
(( $+functions[_fedpkg-diff] )) ||
_fedpkg-diff () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]' \
'--cached[view staged changes]' \
'*:file:_files'
}
(( $+functions[_fedpkg-gimmespec] )) ||
_fedpkg-gimmespec () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]'
}
(( $+functions[_fedpkg-gitbuildhash] )) ||
_fedpkg-gitbuildhash () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]' \
':build'
}
(( $+functions[_fedpkg-giturl] )) ||
_fedpkg-giturl () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message and exit]'
}
(( $+functions[_fedpkg-import] )) ||
_fedpkg-import () {
_arguments -C \
'(-h --help)'{-h,--help}'[show help message