[devel] I: zsh completion for hasher and gear

Alexey I. Froloff =?iso-8859-1?q?raorn_=CE=C1_immo=2Eru?=
Пт Май 12 00:23:00 MSD 2006


"В субботу состоится велосипедный поход для любителей этого дела.
Этого дела брать по бутылке на нос."


$ echo 'fpath=(~/.zsh/functions ~/.zsh/Completion $fpath)' >> ~/.zshenv
$ cp _gear _hasher ~/.zsh/Completion

И радуемся жизни.  Прошу потестить, если устраивает, подвешу в
багзиллу.

-- 
Regards,
Sir Raorn.
----------- следующая часть -----------
#compdef hsh hsh-install hsh-run hsh-shell

local curcontext="$curcontext" packages common_opts ret=1

__sisyphus_check_tests () {
    local expl tests

    tests=(
	'buildhost'
	'buildtime'
	'changelog'
	'content'
	'deps'
	'description'
	'fhs'
	'gpg'
	'gpgname'
	'group'
	'intersects'
	'libtool'
	'locales'
	'nvr'
	'packager'
	'perms'
	'printable'
	'summary'
    )

    _wanted tests expl test compadd -a "$@" - tests
}

common_opts=(
    '--hasher-priv-dir=[hasher-priv directory]:hasher-priv:_directories'
    '--number=[subconfig identifier]:number'
    '--save-fakeroot[save fakeroot state]'
    '(-v --verbose -q --quiet)'{-q,--quiet}'[try to be more quiet]'
    '(-v --verbose -q --quiet)'{-v,--verbose}'[print a message for each action]'
    '(- :)'{-V,--version}'[print program version and exit]'
    '(- :)'{-h,--help}'[show usage and exit]'
)

case "$service" in
    hsh)
	if (( $words[(I)--(initroot|cleanup)-only] )); then
	    packages=
	else
	    packages='*:package:_files -g "*.(rpm|tar)"'
	fi
	_arguments -S \
	    $common_opts \
	    '--apt-config=[path to custom apt.conf file]:apt-config:_files' \
	    '--apt-prefix=[path to apt directory prefix]:apt-prefix:_directories' \
	    '--build-args=[extra arguments for rpmbuild]:rpmbuild args:' \
	    '(--initroot-only)--cleanup-only[do not build at all, just cleanup workdir]' \
	    '--eager-cleanup[cleanup build environment after each successful build]' \
	    '--lazy-cleanup[cleanup build environment before each new build]' \
	    '--excludedocs[do not install documentation files]' \
	    '(--cleanup-only)--initroot-only[do not build, stop after initroot stage]' \
	    '--install-langs=[colon-separated list of languages to install]:languages' \
	    '--mountpoints=[comma-separated list of known mount points]:mountpoints' \
	    '--no-cache[do not use initroot cache]' \
	    '--no-contents-indices[do not use content indices]' \
	    '(--repackage-source)--no-repackage-source[do not repackage source along with binaries]' \
	    '--no-sisyphus-check-in=[do not run sisyphus_check input tests]::sisyphus_check tests:__sisyphus_check_tests -S, -q' \
	    '--no-sisyphus-check=[do not run sisyphus_check tests]::sisyphus_check tests:__sisyphus_check_tests -S, -q' \
	    '--no-sisyphus-check-out=[do not run sisyphus_check output tests]::sisyphus_check tests:__sisyphus_check_tests -S, -q' \
	    '--nprocs=[number of CPUs to use]:number' \
	    '--pkg-build-list=[override default build package file list]:packages' \
	    '--pkg-init-list=[override default initial package file list]:packages' \
	    '(--query-req-prog)--query-repackage[repackage the source before query for requirements]' \
	    '(--query-repackage)--query-req-prog=[program to run to query for requirements]:query-req-prog:_files' \
	    '(--no-repackage-source)--repackage-source[repackage source along with binaries]' \
	    '--repo=[repository directory]:repository directory' \
	    '--target=[target architecture]:architecture' \
	    '(--with-stuff)--without-stuff[do not use built packages]' \
	    '(--without-stuff)--with-stuff[allow use of built packages]' \
	    ':workdir:_directories' \
	    $packages && ret=0

	;;
    hsh-install)
	_arguments -S \
	    $common_opts \
	    '--excludedocs[do not install documentation files]' \
	    ':workdir:_directories' \
	    '*:package' && ret=0

	;;
    hsh-run|hsh-shell)
	_arguments -S \
	    $common_opts \
	    '--builder[run program as builder]' \
	    '--execute=[copy given script to workdir and execute it]:script:_files' \
	    '--mountpoints=[comma-separated list of known mount points]:mountpoints' \
	    '--pty[redirect standard descriptors to controlling pty]' \
	    '--rooter=[run program as pseudoroot]' \
	    '--shell=[run interactive shell]::shell:_files' \
	    '--x11-timeout=[how long X11 authorization will be valid]:seconds' \
	    '(-x -X -Y)-x[disable X11 forwarding]' \
	    '(-x -X -Y)-X[enable X11 forwarding]' \
	    '(-x -X -Y)-Y[enable trusted X11 forwarding]' \
	    ':workdir:_directories' \
	    '(-):command name: _command_names -e' \
	    '*::arguments: _normal' && ret=0

	;;
esac
----------- следующая часть -----------
#compdef gear

local curcontext="$curcontext" ret=1

_arguments -S \
    '(-v --verbose -q --quiet)'{-q,--quiet}'[try to be more quiet]' \
    '(-v --verbose -q --quiet)'{-v,--verbose}'[print a message for each action]' \
    '(- :)'{-V,--version}'[print program version and exit]' \
    '(- :)'{-h,--help}'[show usage and exit]' \
    '(-r --rules)'{-r,--rules=}'[name of file with rules]:rules file:_files' \
    '(-t --tree-ish)'{-t,--tree-ish=}'[tree, commit or tag object name]:tree-ish' \
    - 'export' \
    '(--export-dir --no-compress --bzip2 --gzip)--no-compress[do not compress output archive]' \
    '(--export-dir --no-compress --bzip2 --gzip)--bzip2[compress output archive using bzip2]' \
    '(--export-dir --no-compress --bzip2 --gzip)--gzip[compress output archive using gzip]' \
    '(--no-compress --bzip2 --gzip :)--export-dir=[write source files to specified directory]:directory:_directories' \
    ':output tarball:_files' \
    - 'hasher' \
    '--hasher[execute hsh-like command afterwards]' \
    '(-):command: _command_names -e' \
    '*::args: _normal' \
    - 'rpmbuld' \
    '--rpmbuild[execute rpmbuild-like command afterwards]' \
    '(-):command: _command_names -e' \
    '*::args: _normal' \
    && ret=0

----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип     : application/pgp-signature
Размер  : 191 байтов
Описание: Digital signature
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20060512/f44d0c11/attachment-0001.bin>


Подробная информация о списке рассылки Devel