From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sun, 17 May 2009 01:37:38 +0400 From: "Alexey I. Froloff" To: ALT Devel discussion list Message-ID: <20090516213738.GQ20646@altlinux.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Yq3EGcigLBTDQpeG" Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Subject: [devel] git.alt - new zsh completion X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 21:37:39 -0000 Archived-At: List-Archive: List-Post: --Yq3EGcigLBTDQpeG Content-Type: multipart/mixed; boundary="N7hiGSZV0P2B4+ho" Content-Disposition: inline --N7hiGSZV0P2B4+ho Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =F1 =D0=C5=D2=C5=D0=C9=D3=C1=CC =CB=CF=CD=D0=CC=C9=DB=CE =C4=CC=D1 git.alt.= =F4=C5=D0=C5=D2=D8 =CF=CE=CF =CB=CF=CD=D0=CC=C9=D4=C9=D4 =D5=C4=C1=CC=A3= =CE=CE=D9=C5 =D0=D5=D4=C9 =C4=CC=D1 clone/rm-db/mv-db, =CE=CF=CD=C5=D2=C1 =D4=C1=D3=CB= =CF=D7, =C1 =C5=D3=CC=C9 =CD=CF=CA =D0=C1=D4=DE=C9=CB =CB girar =C2=D5=C4=C5=D4 =D0=D2=C9=CC=CF=D6=C5=CE, =D4=CF =C9 =CE=CF=CD=C5=D2= =C1 =D3=D5=C2=D4=C1=D3=CB=CF=D7. P.S. build srpm =D0=CF=C4=C4=C5=D2=D6=C9=D7=C1=C5=D4=D3=D1. --=20 Regards, Sir Raorn. --N7hiGSZV0P2B4+ho Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=_git_alt #compdef git.alt _git_alt_directories() { local expl local -a remfiles if compset -P '?*/'; then remfiles=(${${${${${${${(M)${${(f)"$(_call_program package-repository git.alt ls ${words[CURRENT]%/*})"}:#total *}:#d*}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}) elif compset -P /; then remfiles=(people archive gears) else remfiles=(${${${${${${${(M)${${(f)"$(_call_program package-repository git.alt ls)"}:#total *}:#d*}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}) fi _wanted files expl 'git.alt directories' \ compadd -S/ -q -- $remfiles } _git_alt_tasks() { local -a tasks tasks=(${${${${(f)"$(_call_program task-id git.alt task ls --old)"}#\#}//:/\\:}/ /:}) _describe -t task-id 'task id' tasks } _git_alt_all_tasks() { local -a tasks tasks=(${${${${(f)"$(_call_program any-task-id git.alt task ls --all)"}#\#}//:/\\:}/ /:}) _describe -t any-task-id 'task id' tasks } _git_alt_subtasks() { local -a subtasks # Assumes that task id comes right before subtask id # Needs patched girar on server side subtasks=(${${(f)"$(_call_program any-task-id git.alt task show --brief ${words[(( CURRENT - 1 ))]})"}# }) _describe -t subtask-id 'subtask id' subtasks } _git_alt_package_repositories() { local -a repos repos=( ${${${${${${${${(M)${${(f)"$(_call_program package-repository git.alt ls packages)"}:#total *}:#d*}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}%.git} ) _describe -t package-repository 'package repository' repos } _git_alt_package_tags() { local -a tags tags=( ${(M)${${${${(f)"$(_call_program package-tag git ls-remote -t git.alt:packages/${words[(( CURRENT - 1 ))]}.git)"}:#*\^\{\}}##* }#refs/tags/}:#*-alt*} ) _describe -t package-tag 'package tag' tags } _git_alt_srpms() { local -a srpms srpms=( ${${${${${${${${(M)${${(f)"$(_call_program source-rpm git.alt ls incoming)"}:#total *}:#*.src.rpm}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}%.git} ) _describe -t source-rpm 'source rpm' srpms } local -a args reply args=( # Command word. Don't care what that is. /$'[^\0]#\0'/ ) local -a charset_args charset_args=( /$'[^\0]#\0'/ ':git-repository:path to git repository:_git_alt_directories' /$'[^\0]#\0'/ ':character-set:charset:' ) local -a clone_args clone_args=( /$'[^\0]#\0'/ ':git-repository:source git repository:_git_alt_directories' /$'[^\0]#\0'/ ':git-directory:destination directory:_git_alt_directories' ) local -a find_package_args find_package_args=( /$'[^\0]#\0'/ ':pattern:search pattern:' ) local -a init_db_args init_db_args=( /$'((packages|private|public)/)#[A-Za-z0-9][-A-Za-z0-9_.]##\0'/ ':repository-name:repository name:' ) local -a ls_args ls_args=( /$'[^\0]#\0'/ ':git-directory:git.alt directory:_git_alt_directories' ) local -a mv_db_args mv_db_args=( /$'[^\0]#\0'/ ':git-repository:source git repository:_git_alt_directories' /$'[^\0]#\0'/ ':git-directory:destination directory:_git_alt_directories' ) local -a rm_db_args rm_db_args=( /$'[^\0]#\0'/ ':git-repository:git repository:_git_alt_directories' ) local -a task_ls_args _regex_words \ task-ls-args "task ls argument" \ '--all:list all tasks' task_ls_args=( '(' "$reply[@]" '|' ')' ) local -a task_id_arg task_id_arg=( /$'[[:digit:]]##\0'/ ':task-id:task id:_git_alt_tasks' ) local -a task_any_id_arg task_any_id_arg=( /$'[[:digit:]]##\0'/ ':task-id:task id:_git_alt_all_tasks' ) local -a binary_repo_arg _regex_words \ binary-repositories "binary repository" \ 'sisyphus:Sisyphus' \ '5.0:branch/5.0' \ '4.1:branch/4.1' \ '4.0:branch/4.0' binary_repo_arg=("$reply[@]") local -a repo_tag_args repo_tag_args=( /$'[A-Za-z0-9][-A-Za-z0-9_.]##\0'/ ':package-repository:package repository:_git_alt_package_repositories' /$'[^\0]##-alt[^\0]##\0'/ ':package-tag:package tag:_git_alt_package_tags' ) local -a source_rpm_arg source_rpm_arg=( /$'[^\0]##.src.rpm\0'/ ':source-rpm:source rpm:_git_alt_srpms' ) local -a package_name_arg package_name_arg=( /$'[^@\0]##\0'/ ':package-name:package name:' ) local -a group_name_arg group_name_arg=( /$'@[a-z_0-9]##\0'/ ':group-id:group name:' ) local -a login_arg login_arg=( /$'[a-z_0-9]##\0'/ ':user-id:maintainer:' ) local -a task_add_subcmd _regex_words \ task-add-commands "task add command" \ 'repo:build from git repository:$repo_tag_args' \ 'srpm:source rpm name:$source_rpm_arg' \ 'del:delete package:$package_name_arg' \ 'copy:copy from another repository:$package_name_arg $binary_repo_arg' task_add_subcmd=( '(' $task_id_arg '|' ')' "$reply[@]") local -a task_subtask_id_arg task_subtask_id_arg=( /$'[[:digit:]]##\0'/ ':subtask-id:subtask id:_git_alt_subtasks' ) local -a task_share_args _regex_words \ task-share-command "task share command" \ 'status:show status' \ 'enabled:share task' \ 'disabled:unshare task' task_share_args=( '(' $task_id_arg '|' ')' "$reply[@]" ) local -a task_commands _regex_words \ task-commands "task command" \ 'ls:list tasks:$task_ls_args' \ 'show:show task:\( $task_any_id_arg \| \)' \ 'new:new task:$binary_repo_arg' \ 'add:add subtask:$task_add_subcmd' \ 'delsub:delete subtask:$task_id_arg $task_subtask_id_arg' \ 'run:run task:\( $task_id_arg \| \)' \ 'share:share task:$task_share_args' \ 'approve:approve subtask:$task_any_id_arg $task_subtask_id_arg' \ 'rm:delete task:\( $task_id_arg \| \)' task_commands=("$reply[@]") local -a build_args _regex_words \ build-options "build option" \ '-b:binary repository name:$binary_repo_arg' build_args=( '(' "$reply[@]" '|' ')' '(' /$'srpm\0'/ ':build-command:build command:(( srpm:build\ source\ rpm ))' $source_rpm_arg '|' $repo_tag_args ')' '#' ) local -a acl_login_group_arg acl_login_group_arg=( '(' $group_name_arg '|' $login_arg ')' ) local -a acl_package_group_arg acl_package_group_arg=( '(' $group_name_arg '|' $package_name_arg ')' ) local -a timestamp timestamp=( /$'[[:digit:]]##\0'/ ':timestamp:timestamp:' ) local -a acl_nmu_cmds _regex_words \ acl-nmu-command "acl nmu command" \ 'show:show nmu status' \ 'add:add nmu rights:$login_arg $timestamp $timestamp' \ 'del:delete nmu rights:$login_arg $timestamp $timestamp' acl_nmu_cmds=("$reply[@]") local -a acl_cmds _regex_words \ acl-command "acl command" \ 'nmu:nmu management:$acl_nmu_cmds' \ 'check:check acl' \ 'show:show acl' \ 'add:add acl:\( $acl_login_group_arg \# \)' \ 'del:delete acl:\( $acl_login_group_arg \# \)' \ 'leader:set leader:$acl_login_group_arg' \ 'replace:replace acl:\( $acl_login_group_arg \# \)' acl_cmds=("$reply[@]") local -a acl_list_arg _regex_words \ acl-option "acl option" \ '--list:list binary repositories' acl_list_arg=("$reply[@]") local -a acl_args acl_args=( '(' $acl_list_arg '|' $binary_repo_arg $acl_package_group_arg $acl_cmds ')' ) _regex_words \ commands "git.alt command" \ 'help:show git.alt command reference' \ 'charset:set default character encoding for repository:$charset_args' \ 'clone:clone repository:$clone_args' \ 'find-package:search repository:$find_package_args' \ 'init-db:create new repository:$init_db_args' \ 'ls:list git.alt directory:$ls_args' \ 'mv-db:rename/move repository:$mv_db_args' \ 'quota:show user quota information' \ 'rm-db:delete repository:$rm_db_args' \ 'task:manage tasks:$task_commands' \ 'build:build package:$build_args' \ 'acl:manage package access control lists:$acl_args' args+=("$reply[@]") _regex_arguments _git_alt "${args[@]}" _git_alt "$@" --N7hiGSZV0P2B4+ho-- --Yq3EGcigLBTDQpeG Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkoPMiIACgkQVqT7+fkT8wq9GACgl43fuwBrfLAocVWK9Xx7/qFB hVkAnjeHzQY3xenxbm7M6NU6VvxMfCpy =rkoV -----END PGP SIGNATURE----- --Yq3EGcigLBTDQpeG--