mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-09 02:24:03 +01:00
Creating new completion scheme for buildbot and repo tools
This commit is contained in:
parent
615e41b0ec
commit
f84b2eddeb
12 changed files with 507 additions and 1 deletions
51
plugins/buildbot/_buildbot
Normal file
51
plugins/buildbot/_buildbot
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#compdef buildbot
|
||||
|
||||
_buildbot()
|
||||
{
|
||||
typeset -A opt_args
|
||||
local context state line curcontext="$curcontext"
|
||||
|
||||
local ret=1
|
||||
|
||||
_arguments -C \
|
||||
'(- 1 *)--help[show usage]'\
|
||||
'(- 1 *)--version[display version]'\
|
||||
'(- 1 *)--verbose[verbose output]'\
|
||||
'1:command:->command'\
|
||||
'*::args:->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
local commands;
|
||||
commands=(
|
||||
'create-master:Create and populate a directory for a new buildmaster'
|
||||
'upgrade-master:Upgrade an existing buildmaster directory for the current version'
|
||||
'start:Start a buildmaster'
|
||||
'stop:Stop a buildmaster'
|
||||
'restart:Restart a buildmaster'
|
||||
'reconfig:SIGHUP a buildmaster to make it re-read the config file'
|
||||
'sighup:SIGHUP a buildmaster to make it re-read the config file'
|
||||
'sendchange:Send a change to the buildmaster'
|
||||
'debugclient:Launch a small debug panel GUI'
|
||||
'statuslog:Emit current builder status to stdout'
|
||||
'statusgui:Display a small window showing current builder status'
|
||||
'try:Run a build with your local changes'
|
||||
'tryserver:buildmaster-side "try" support function, not for users'
|
||||
'checkconfig:test the validity of a master.cfg config file'
|
||||
'user:Manage users in buildbot''s database'
|
||||
)
|
||||
_describe -t commands 'command' commands && ret=0
|
||||
;;
|
||||
(args)
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
_buildbot "$@"
|
||||
return $?
|
||||
|
||||
|
||||
|
||||
8
plugins/buildbot/buildbot.plugin.zsh
Normal file
8
plugins/buildbot/buildbot.plugin.zsh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#compdef buildbot
|
||||
|
||||
# Aliases
|
||||
alias b='buildbot'
|
||||
|
||||
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||||
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
encode64(){ echo -n $1 | base64 }
|
||||
decode64(){ echo -n $1 | base64 -D }
|
||||
decode64(){ echo -n $1 | base64 -d }
|
||||
alias e64=encode64
|
||||
alias d64=decode64
|
||||
|
|
|
|||
74
plugins/git/_git-remote
Normal file
74
plugins/git/_git-remote
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#compdef git-remote
|
||||
|
||||
# NOTE: --track is undocumented.
|
||||
# TODO: --track, -t, --master, and -m should take remote branches, I guess.
|
||||
# NOTE: --master is undocumented.
|
||||
# NOTE: --fetch is undocumented.
|
||||
_git-remote () {
|
||||
local curcontext=$curcontext state line
|
||||
declare -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
declare -a commands
|
||||
|
||||
commands=(
|
||||
'add:add a new remote'
|
||||
'show:show information about a given remote'
|
||||
'prune:delete all stale tracking branches for a given remote'
|
||||
'update:fetch updates for a set of remotes'
|
||||
'rm:remove a remote from .git/config and all associated tracking branches'
|
||||
'rename:rename a remote from .git/config and update all associated tracking branches'
|
||||
'set-head:sets or deletes the default branch'
|
||||
'set-branches:changes the list of branches tracked by the named remote.'
|
||||
'set-url:changes URL remote points to.'
|
||||
)
|
||||
|
||||
_describe -t commands 'sub-command' commands && ret=0
|
||||
;;
|
||||
(options)
|
||||
case $line[1] in
|
||||
(add)
|
||||
_arguments \
|
||||
'*'{--track,-t}'[track given branch instead of default glob refspec]:branch:__git_branch_names' \
|
||||
'(--master -m)'{--master,-m}'[set the remote'\''s HEAD to point to given master branch]:branch:__git_branch_names' \
|
||||
'(--fetch -f)'{--fetch,-f}'[run git-fetch on the new remote after it has been created]' \
|
||||
':branch name:__git_remotes' \
|
||||
':url:_urls' && ret=0
|
||||
;;
|
||||
(show)
|
||||
_arguments \
|
||||
'-n[do not contact the remote for a list of branches]' \
|
||||
':remote:__git_remotes' && ret=0
|
||||
;;
|
||||
(prune)
|
||||
_arguments \
|
||||
'(--dry-run -n)'{-n,--dry-run}'[do not actually prune, only list what would be done]' \
|
||||
':remote:__git_remotes' && ret=0
|
||||
;;
|
||||
(update)
|
||||
__git_remote-groups && ret=0
|
||||
;;
|
||||
(rm)
|
||||
__git_remotes && ret=0
|
||||
;;
|
||||
(rename)
|
||||
__git_remotes && ret=0
|
||||
;;
|
||||
(set-url)
|
||||
_arguments \
|
||||
'*--push[manipulate push URLs]' \
|
||||
'(--add)--add[add URL]' \
|
||||
'(--delete)--delete[delete URLs]' \
|
||||
':branch name:__git_remotes' \
|
||||
':url:_urls' && ret=0
|
||||
;;
|
||||
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
@ -10,3 +10,4 @@ function pyclean() {
|
|||
|
||||
# Grep among .py files
|
||||
alias pygrep='grep --include="*.py"'
|
||||
|
||||
|
|
|
|||
146
plugins/repo/_repo
Normal file
146
plugins/repo/_repo
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#compdef repo
|
||||
|
||||
_repo()
|
||||
{
|
||||
typeset -A opt_args
|
||||
local context state line curcontext="$curcontext"
|
||||
|
||||
local ret=1
|
||||
|
||||
_arguments -C \
|
||||
'(- 1 *)--help[show usage]'\
|
||||
'1:command:->command'\
|
||||
'*::args:->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
repo list 2> /dev/null > /dev/null
|
||||
if [[ $? == 0 ]]; then
|
||||
local commands;
|
||||
commands=(
|
||||
'abandon:Permanently abandon a development branch'
|
||||
'branch:View current topic branches'
|
||||
'branches:View current topic branches'
|
||||
'checkout:Checkout a branch for development'
|
||||
'checkout-manifest:for every project in a manifest tag file check out the sha1 listed in the file'
|
||||
'cherry-pick:Cherry-pick a change.'
|
||||
'diff:Show changes between commit and working tree'
|
||||
'download:Download and checkout a change'
|
||||
'format-patch:build patch sets for each project common to a manifest baseline'
|
||||
'grep:Print lines matching a pattern'
|
||||
'help:Display detailed help on a command'
|
||||
'init:Initialize repo in the current directory'
|
||||
'list:List projects and their associated directories'
|
||||
'overview:Display overview of unmerged project branches'
|
||||
'prune:Prune (delete) already merged topics'
|
||||
'push:Push the local branch rebase:Rebase local branches on upstream branch'
|
||||
'smartsync:Update working tree to the latest known good revision'
|
||||
'stage:Stage file(s) for commit start:Start a new branch for development'
|
||||
'status:Show the working tree status sync:Update working tree to the latest revision'
|
||||
'sync:Update working tree to the latest revision'
|
||||
'tag-manifest:for every project in a manifest tag use the sha1 listed in the file set the tagname to it'
|
||||
'upload:Upload changes for code review'
|
||||
)
|
||||
_describe -t commands 'command' commands && ret=0
|
||||
else
|
||||
local commands;
|
||||
commands=(
|
||||
'init:Install repo in the current working directory'
|
||||
'help:Display detailed help on a command'
|
||||
)
|
||||
_describe -t commands 'command' commands && ret=0
|
||||
fi
|
||||
;;
|
||||
(args)
|
||||
|
||||
case $words[1] in
|
||||
(branch | branches )
|
||||
# TODO : list available projects and add them in list to feed compadd with
|
||||
_arguments :::_branches_projects
|
||||
;;
|
||||
(init)
|
||||
_arguments \
|
||||
"(-h --help)"{-h,--help}"[Show help]" \
|
||||
"(-q --quiet)"{-q,--quiet}"[be quiet]" \
|
||||
"(-u --manifest-url)"{-u,--manifest-url=}"[manifest repository location]":url:_url \
|
||||
"(-b --manifest-branch)"{-b,--manifest-branch=}"[manifest branch or revision]":branch:_branch\
|
||||
"(-m --manifest-name)"{-m,--manifest-name=}"[initial manifest file]":manifest_name:_manifest_name\
|
||||
"(--mirror)--mirror[mirror the forrest]"\
|
||||
"(--reference)--reference=[location of mirror directory]":dir:_dirs\
|
||||
"(--depth)--depth=[create a shallow clone with given depth; see git clone]":depth:_depth\
|
||||
"(-g --group=)"{-g,--group=}"[restrict manifest projects to ones with a specified group]":group:_group\
|
||||
"(-p --platform=)"{-p,--platform=}"[restrict manifest projects to ones with a specified platform group(auto|all|none|linux|darwin|...)]":platform:_platform\
|
||||
"(--repo-url)--repo-url=[repo repository location]":url:_url\
|
||||
"(--repo-branch)--repo-branch[repo branch or revision]":branch_or_rev:_branch_or_rev\
|
||||
"(--no-repo-verify)--no-repo-verify[do not verify repo source code]"\
|
||||
"(--config-name)--config-name[Always prompt for name/e-mail]"\
|
||||
&& ret=0
|
||||
;;
|
||||
*)
|
||||
ret=0
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
_url()
|
||||
{
|
||||
_message -e url 'url'
|
||||
}
|
||||
|
||||
_platform()
|
||||
{
|
||||
_message -e platform 'platform group(auto|all|none|linux|darwin|...)'
|
||||
}
|
||||
|
||||
_manifest_name()
|
||||
{
|
||||
_message -e manifest_name 'manifest name'
|
||||
}
|
||||
|
||||
_group()
|
||||
{
|
||||
_message -e group 'group'
|
||||
}
|
||||
|
||||
_branch()
|
||||
{
|
||||
_message -e branch 'branch'
|
||||
}
|
||||
|
||||
_branch_or_rev()
|
||||
{
|
||||
_message -e branch_or_rev 'repo branch or revision'
|
||||
}
|
||||
|
||||
_depth()
|
||||
{
|
||||
_message -e depth 'depth'
|
||||
}
|
||||
|
||||
_branches_projects()
|
||||
{
|
||||
_message -e depth '<projects>...'
|
||||
}
|
||||
|
||||
_repo "$@"
|
||||
return $?
|
||||
|
||||
|
||||
#typeset -A opt_args
|
||||
|
||||
local context state line
|
||||
local fontdir
|
||||
|
||||
_arguments \
|
||||
"(-l -c -r)init[Install repo in the current working directory]" \
|
||||
"(-l -c -r)help[Display detailed help on a command]" \
|
||||
&& return 0
|
||||
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
146
plugins/repo/_repo~
Normal file
146
plugins/repo/_repo~
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#compdef repo
|
||||
|
||||
_repo()
|
||||
{
|
||||
typeset -A opt_args
|
||||
local context state line curcontext="$curcontext"
|
||||
|
||||
local ret=1
|
||||
|
||||
_arguments -C \
|
||||
'(- 1 *)--help[show usage]'\
|
||||
'1:command:->command'\
|
||||
'*::args:->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
repo status 2> /dev/null > /dev/null
|
||||
if [[ $? == 0 ]]; then
|
||||
local commands;
|
||||
commands=(
|
||||
'abandon:Permanently abandon a development branch'
|
||||
'branch:View current topic branches'
|
||||
'branches:View current topic branches'
|
||||
'checkout:Checkout a branch for development'
|
||||
'checkout-manifest:for every project in a manifest tag file check out the sha1 listed in the file'
|
||||
'cherry-pick:Cherry-pick a change.'
|
||||
'diff:Show changes between commit and working tree'
|
||||
'download:Download and checkout a change'
|
||||
'format-patch:build patch sets for each project common to a manifest baseline'
|
||||
'grep:Print lines matching a pattern'
|
||||
'help:Display detailed help on a command'
|
||||
'init:Initialize repo in the current directory'
|
||||
'list:List projects and their associated directories'
|
||||
'overview:Display overview of unmerged project branches'
|
||||
'prune:Prune (delete) already merged topics'
|
||||
'push:Push the local branch rebase:Rebase local branches on upstream branch'
|
||||
'smartsync:Update working tree to the latest known good revision'
|
||||
'stage:Stage file(s) for commit start:Start a new branch for development'
|
||||
'status:Show the working tree status sync:Update working tree to the latest revision'
|
||||
'sync:Update working tree to the latest revision'
|
||||
'tag-manifest:for every project in a manifest tag use the sha1 listed in the file set the tagname to it'
|
||||
'upload:Upload changes for code review'
|
||||
)
|
||||
_describe -t commands 'command' commands && ret=0
|
||||
else
|
||||
local commands;
|
||||
commands=(
|
||||
'init:Install repo in the current working directory'
|
||||
'help:Display detailed help on a command'
|
||||
)
|
||||
_describe -t commands 'command' commands && ret=0
|
||||
fi
|
||||
;;
|
||||
(args)
|
||||
|
||||
case $words[1] in
|
||||
(branch | branches )
|
||||
# TODO : list available projects and add them in list to feed compadd with
|
||||
_arguments :::_branches_projects
|
||||
;;
|
||||
(init)
|
||||
_arguments \
|
||||
"(-h --help)"{-h,--help}"[Show help]" \
|
||||
"(-q --quiet)"{-q,--quiet}"[be quiet]" \
|
||||
"(-u --manifest-url)"{-u,--manifest-url=}"[manifest repository location]":url:_url \
|
||||
"(-b --manifest-branch)"{-b,--manifest-branch=}"[manifest branch or revision]":branch:_branch\
|
||||
"(-m --manifest-name)"{-m,--manifest-name=}"[initial manifest file]":manifest_name:_manifest_name\
|
||||
"(--mirror)--mirror[mirror the forrest]"\
|
||||
"(--reference)--reference=[location of mirror directory]":dir:_dirs\
|
||||
"(--depth)--depth=[create a shallow clone with given depth; see git clone]":depth:_depth\
|
||||
"(-g --group=)"{-g,--group=}"[restrict manifest projects to ones with a specified group]":group:_group\
|
||||
"(-p --platform=)"{-p,--platform=}"[restrict manifest projects to ones with a specified platform group(auto|all|none|linux|darwin|...)]":platform:_platform\
|
||||
"(--repo-url)--repo-url=[repo repository location]":url:_url\
|
||||
"(--repo-branch)--repo-branch[repo branch or revision]":branch_or_rev:_branch_or_rev\
|
||||
"(--no-repo-verify)--no-repo-verify[do not verify repo source code]"\
|
||||
"(--config-name)--config-name[Always prompt for name/e-mail]"\
|
||||
&& ret=0
|
||||
;;
|
||||
*)
|
||||
ret=0
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
_url()
|
||||
{
|
||||
_message -e url 'url'
|
||||
}
|
||||
|
||||
_platform()
|
||||
{
|
||||
_message -e platform 'platform group(auto|all|none|linux|darwin|...)'
|
||||
}
|
||||
|
||||
_manifest_name()
|
||||
{
|
||||
_message -e manifest_name 'manifest name'
|
||||
}
|
||||
|
||||
_group()
|
||||
{
|
||||
_message -e group 'group'
|
||||
}
|
||||
|
||||
_branch()
|
||||
{
|
||||
_message -e branch 'branch'
|
||||
}
|
||||
|
||||
_branch_or_rev()
|
||||
{
|
||||
_message -e branch_or_rev 'repo branch or revision'
|
||||
}
|
||||
|
||||
_depth()
|
||||
{
|
||||
_message -e depth 'depth'
|
||||
}
|
||||
|
||||
_branches_projects()
|
||||
{
|
||||
_message -e depth '<projects>...'
|
||||
}
|
||||
|
||||
_repo "$@"
|
||||
return $?
|
||||
|
||||
|
||||
#typeset -A opt_args
|
||||
|
||||
local context state line
|
||||
local fontdir
|
||||
|
||||
_arguments \
|
||||
"(-l -c -r)init[Install repo in the current working directory]" \
|
||||
"(-l -c -r)help[Display detailed help on a command]" \
|
||||
&& return 0
|
||||
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
36
plugins/repo/repo.plugin.zsh
Normal file
36
plugins/repo/repo.plugin.zsh
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Aliases
|
||||
#alias r='repo'
|
||||
|
||||
##
|
||||
#function listRepoCompletions {
|
||||
# reply=(
|
||||
# abandon
|
||||
#branch
|
||||
# branches
|
||||
# checkout
|
||||
# checkout-manifest
|
||||
# cherry-pick
|
||||
# diff
|
||||
#download
|
||||
# format-patch
|
||||
# forall
|
||||
# grep
|
||||
# help
|
||||
# init
|
||||
# list
|
||||
#overview
|
||||
# prune
|
||||
# push
|
||||
# rebase
|
||||
# smartsync
|
||||
# stage
|
||||
# start
|
||||
# status
|
||||
#sync
|
||||
# tag-manifest
|
||||
# upload
|
||||
# );
|
||||
#}
|
||||
|
||||
###compctl -K listRepoCompletions repo
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue