From b5e6ef5025c30cd19e9b41d63ee97285918f5c04 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Sat, 9 Aug 2008 23:30:50 -0400 Subject: [PATCH] yap.zsh: flesh out completions --- yap.zsh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/yap.zsh b/yap.zsh index 3070d55..f95c521 100644 --- a/yap.zsh +++ b/yap.zsh @@ -9,10 +9,14 @@ _yap-commands () { 'clone:make a local copy of an existing repository' 'commit:record changes to files as a new commit' 'diff:show staged, unstaged, or all uncommitted changes' + 'fetch:retrieve commits from a remote repository' 'history:alter history by dropping or amending commits' 'init:turn a directory into a repository' 'log:show the changelog for particular versions or files' + 'merge:merge a branch into the current branch' + 'plugins:show information about loaded plugins' 'point:move the current branch to a different revision' + 'push:send local commits to a remote repository' 'repo:list, add, or delete configured remote repositories' 'revert:remove uncommitted changes from a file (*)' 'resolved:mark files with conflicts as resolved' @@ -72,6 +76,59 @@ _yap-branch () { '*:branch:__git_heads' && ret=0 } +_yap-commit () { + _arguments \ + '(-d)-a[commit all changes]' \ + '(-a)-d[commit only staged changes]' \ + '-m[specify commit message]:commit message' && ret=0 +} + +_yap-diff () { + _arguments \ + '(-u)-d[show only staged changes]' \ + '(-d)-u[show only unstaged changes]' && ret=0 +} + +__yap_repos () { + repos=( `yap repo | gawk '{print $1}'` ) + compadd - "${repos[@]}" +} + +_yap-repo () { + _arguments \ + '-d[delete a repository]' \ + ':repo:__yap_repos' \ + '*:url' && ret=0 +} + +_yap-fetch () { + _arguments \ + ':repo:__yap_repos' && ret=0 +} + +_yap-log () { + _arguments \ + '-r:revision:__git_heads' \ + '*:files:_files' && ret=0 +} + +_yap-merge () { + _arguments \ + ':branch:__git_heads' && ret=0 +} + +_yap-push () { + _arguments \ + ':repo:__yap_repos' \ + ':branch:__git_heads' && ret=0 +} + +_yap-track () { + _arguments \ + ':repo:__yap_repos' \ + ':branch:__git_heads' && ret=0 +} + _yap () { if (( CURRENT == 2 )); then _yap-commands -- 2.11.4.GIT