* [devel] git.alt - new zsh completion
@ 2009-05-16 21:37 Alexey I. Froloff
2009-05-16 22:29 ` Alexey I. Froloff
0 siblings, 1 reply; 5+ messages in thread
From: Alexey I. Froloff @ 2009-05-16 21:37 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1.1: Type: text/plain, Size: 241 bytes --]
Я переписал комплишн для git.alt. Теперь оно комплитит удалённые
пути для clone/rm-db/mv-db, номера тасков, а если мой патчик к
girar будет приложен, то и номера субтасков.
P.S. build srpm поддерживается.
--
Regards,
Sir Raorn.
[-- Attachment #1.2: _git_alt --]
[-- Type: text/plain, Size: 7683 bytes --]
#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 "$@"
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [devel] git.alt - new zsh completion
2009-05-16 21:37 [devel] git.alt - new zsh completion Alexey I. Froloff
@ 2009-05-16 22:29 ` Alexey I. Froloff
2009-05-19 18:22 ` Andrey Rahmatullin
0 siblings, 1 reply; 5+ messages in thread
From: Alexey I. Froloff @ 2009-05-16 22:29 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]
* Alexey I. Froloff <raorn@> [090517 01:39]:
> Я переписал комплишн для git.alt.
А теперь можно превратить его в 'git alt', как многие хотели
(спасибо ender@ за вопросы).
> #compdef git.alt
#compdef git-alt
> remfiles=($..."$(_call_program package-repository git.alt ls...)
> remfiles=($..."$(_call_program package-repository git.alt ls...)
Тут тоже везде поменять 'git.alt' на 'git alt'
> _regex_arguments _git_alt "${args[@]}"
> _git_alt "$@"
_regex_arguments _git-alt "${args[@]}"
_git-alt "$@"
$ git alt <Tab>
---- git.alt command ----
acl -- manage package access control lists
build -- build package
charset -- set default character encoding for repository
clone -- clone repository
find-package -- search repository
help -- show git.alt command reference
init-db -- create new repository
ls -- list git.alt directory
mv-db -- rename/move repository
quota -- show user quota information
rm-db -- delete repository
task -- manage tasks
--
Regards,
Sir Raorn.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [devel] git.alt - new zsh completion
2009-05-16 22:29 ` Alexey I. Froloff
@ 2009-05-19 18:22 ` Andrey Rahmatullin
2009-05-19 18:58 ` Alexey I. Froloff
0 siblings, 1 reply; 5+ messages in thread
From: Andrey Rahmatullin @ 2009-05-19 18:22 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
On Sun, May 17, 2009 at 02:29:00AM +0400, Alexey I. Froloff wrote:
> * Alexey I. Froloff <raorn@> [090517 01:39]:
> > Я переписал комплишн для git.alt.
> А теперь можно превратить его в 'git alt', как многие хотели
> (спасибо ender@ за вопросы).
git-alt дополняет, git alt нет.
$ git al^I
Completing `arg', `git alias', or `git command'
$ git alt ^I
Completing `arg'
--
WBR, wRAR (ALT Linux Team)
Powered by the ALT Linux fortune(8):
> > Какой язык программирования выбрать, чтобы работать с БД под линукс?
> C++ :)
Это провокация! С провокациями - в talk-room.
-- vsl in community@
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [devel] git.alt - new zsh completion
2009-05-19 18:22 ` Andrey Rahmatullin
@ 2009-05-19 18:58 ` Alexey I. Froloff
2009-05-19 19:00 ` Andrey Rahmatullin
0 siblings, 1 reply; 5+ messages in thread
From: Alexey I. Froloff @ 2009-05-19 18:58 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 471 bytes --]
* Andrey Rahmatullin <wrar@> [090519 22:24]:
> > > Я переписал комплишн для git.alt.
> > А теперь можно превратить его в 'git alt', как многие хотели
> > (спасибо ender@ за вопросы).
> git-alt дополняет, git alt нет.
Файл в _git-alt переименовал?
> $ git al^I
> Completing `arg', `git alias', or `git command'
Это комплишн для git (функция _git) => дополнять "alt" не будет.
> $ git alt ^I
> Completing `arg'
Должно работать.
--
Regards,
Sir Raorn.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [devel] git.alt - new zsh completion
2009-05-19 18:58 ` Alexey I. Froloff
@ 2009-05-19 19:00 ` Andrey Rahmatullin
0 siblings, 0 replies; 5+ messages in thread
From: Andrey Rahmatullin @ 2009-05-19 19:00 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 503 bytes --]
On Tue, May 19, 2009 at 10:58:24PM +0400, Alexey I. Froloff wrote:
> > git-alt дополняет, git alt нет.
> Файл в _git-alt переименовал?
ет.
> > $ git al^I
> > Completing `arg', `git alias', or `git command'
> Это комплишн для git (функция _git) => дополнять "alt" не будет.
Да понятно, но вдруг :)
--
WBR, wRAR (ALT Linux Team)
Powered by the ALT Linux fortune(8):
<roman-> как назвать человека, который в архив rar положил архив zip внутри
которого в архиве rar лежит exe ?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-05-19 19:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-16 21:37 [devel] git.alt - new zsh completion Alexey I. Froloff
2009-05-16 22:29 ` Alexey I. Froloff
2009-05-19 18:22 ` Andrey Rahmatullin
2009-05-19 18:58 ` Alexey I. Froloff
2009-05-19 19:00 ` Andrey Rahmatullin
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git