3a3fd686ee97f26be97f032b77d8d564b69e5bb1
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/repo/README.md b/plugins/repo/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..0b77e6d487fa18bad405763f468058121eafb51e
4--- /dev/null
5+++ b/plugins/repo/README.md
6@@ -0,0 +1,7 @@
7+## repo
8+**Maintainer:** [Stibbons](https://github.com/Stibbons)
9+
10+This plugin mainly add support automatic completion for the repo command line tool:
11+http://code.google.com/p/git-repo/
12+
13+* `r` aliases `repo`
14diff --git a/plugins/repo/_repo b/plugins/repo/_repo
15new file mode 100644
16index 0000000000000000000000000000000000000000..59e39c9542c6a5e44a679cff558aef36848af97c
17--- /dev/null
18+++ b/plugins/repo/_repo
19@@ -0,0 +1,272 @@
20+#compdef repo
21+
22+
23+__git_apply_whitespace_strategies ()
24+{
25+ declare -a strategies
26+
27+ strategies=(
28+ 'nowarn:turn off the trailing-whitespace warning'
29+ 'warn:output trailing-whitespace warning, but apply patch'
30+ 'fix:output trailing-whitespace warning and strip trailing whitespace'
31+ 'error:output trailing-whitespace warning and refuse to apply patch'
32+ 'error-all:same as "error", but output warnings for all files')
33+
34+ _describe -t strategies 'trailing-whitespace resolution strategy' strategies $*
35+}
36+
37+
38+_repo()
39+{
40+ local context state state_descr line curcontext="$curcontext"
41+ typeset -A opt_args
42+
43+ local ret=1
44+
45+ _arguments -C \
46+ '(- 1 *)--help[show usage]'\
47+ '1:command:->command'\
48+ '*::args:->args' && ret=0
49+
50+ case $state in
51+ (command)
52+ repo list 2> /dev/null > /dev/null
53+ if [[ $? == 0 ]]; then
54+ local commands;
55+ commands=(
56+ 'abandon:Permanently abandon a development branch'
57+ 'branch:View current topic branches'
58+ 'branches:View current topic branches'
59+ 'checkout:Checkout a branch for development'
60+ 'cherry-pick:Cherry-pick a change.'
61+ 'diff:Show changes between commit and working tree'
62+ 'download:Download and checkout a change'
63+ 'forall:execute command on several project'
64+ 'grep:Print lines matching a pattern'
65+ 'help:Display detailed help on a command'
66+ 'init:Initialize repo in the current directory'
67+ 'list:List projects and their associated directories'
68+ 'manifest:Manifest inspection utility'
69+ 'overview:Display overview of unmerged project branches'
70+ 'prune:Prune (delete) already merged topics'
71+ 'rebase:Rebase local branches on upstream branch'
72+ 'selfupdate:Update repo to the latest version'
73+ 'smartsync:Update working tree to the latest known good revision'
74+ 'stage:Stage file(s) for commit'
75+ 'start:Start a new branch for development'
76+ 'status:Show the working tree status'
77+ 'sync:Update working tree to the latest revision'
78+ 'upload:Upload changes for code review'
79+ 'version:Display the version of repo'
80+ )
81+ _describe -t commands 'command' commands && ret=0
82+ else
83+ local commands;
84+ commands=(
85+ 'init:Install repo in the current working directory'
86+ 'help:Display detailed help on a command'
87+ )
88+ _describe -t commands 'command' commands && ret=0
89+ fi
90+ ;;
91+ (args)
92+ case $words[1] in
93+ (branch | branches)
94+ # TODO : list available projects and add them in list to feed compadd with
95+ _arguments : \
96+ "(-h --help)"{-h,--help}"[Show help]" \
97+ ': :__repo_projects' \
98+ && ret=0
99+ ;;
100+ (abandon)
101+ # TODO : list available projects and add them in list to feed compadd with
102+ _arguments : \
103+ "(-h --help)"{-h,--help}"[Show help]" \
104+ ':branch name:__repo_branch' \
105+ ': :__repo_projects'\
106+ && ret=0
107+ ;;
108+ (checkout)
109+ # TODO : list available projects and add them in list to feed compadd with
110+ _arguments : \
111+ "(-h --help)"{-h,--help}"[Show help]" \
112+ ':branch name:__repo_branch' \
113+ ': :__repo_projects'\
114+ && ret=0
115+ ;;
116+ (init)
117+ _arguments : \
118+ "(-h --help)"{-h,--help}"[Show help]" \
119diff --git a/plugins/repo/repo.plugin.zsh b/plugins/repo/repo.plugin.zsh
120new file mode 100644
121index 0000000000000000000000000000000000000000..9cc336959345975e0eece56c05557c5d80d762cf
122--- /dev/null
123+++ b/plugins/repo/repo.plugin.zsh
124@@ -0,0 +1,2 @@
125+# Aliases
126+alias r='repo'