2 #description zsh completion for git-cola
4 # The recommended way to install this script is to make a copy of it as a
5 # file named '_git-cola' inside any directory in your fpath.
7 # For example, create a directory '~/.config/zsh/completion',
8 # copy this file to '~/.config/zsh/completion/_git-cola',
9 # and then add the following to your ~/.zshrc file:
11 # fpath=(~/.config/zsh/completion $fpath)
13 __git-cola_common_options () {
14 # these can't be prefixed
15 _arguments '--help[Show help]' \
16 '--icon-theme=-[specify an icon theme name or directory]:theme:(dark light default)' \
17 '--theme=-[specify a GUI theme name]:theme:(dark light default)' \
18 '--prompt[prompt for a repository]' \
19 '--repo=-[open the specified git repository]:repository:_files -/' \
20 '--version[print version number]'
27 if git rev-parse HEAD >/dev/null 2>&1
29 for ref in $(git for-each-ref --format='%(refname:short)')
34 (( $#refs )) && _describe -t refs 'refs' refs
40 __git-cola_common_options
42 '*:patches:_files -g "*.patch"'
45 _git-cola-archive () {
46 __git-cola_common_options
52 __git-cola_common_options
54 '--status-filter=-[status path filter]:path:_files'
58 __git-cola_common_options
60 '--all[show all branches]' \
61 '*:refs:_git-cola_refs'
65 __git-cola_common_options
67 '*:refs:_git-cola_refs'
71 __git-cola_common_options
77 __git-cola_common_options
83 __git-cola_common_options
89 __git-cola_common_options
91 '--autosquash[move commits that begin with squash!/fixup!]' \
92 '--autostash[automatically stash/stash pop before and after]' \
93 '--fork-point[use "merge-base --fork-point" to refine upstream]' \
94 '--onto=-[rebase onto given branch instead of upstream]:ref:_git-cola_refs' \
95 '--preserve-merges[try to recreate merges instead of ignoring them]' \
96 '--root[rebase all reachable commits up to the root(s)]' \
97 '--strategy=-[use the given merge strategy]:strategy:(recursive resolve octopus ort ours subtree)' \
98 '--verify[allow pre-rebase hook to run]' \
99 '--continue[continue]' \
100 '--abort[abort adn check out the original branch]' \
101 '--skip[skip current patch and continue]' \
102 '--edit-todo[edit the todo list]' \
103 ':ref:_git-cola_refs' \
104 ':ref:_git-cola_refs'
108 __git-cola_common_options
110 '--sign[annotated and GPG-signed tag]' \
112 ':ref:_git-cola_refs'
117 local curcontext="$curcontext" state line
120 ':command:->command' \
121 '*::options:->options' \
125 #breaks if defined outside the func
128 'about:about git-cola'
129 'am:apply patches using "git am"'
130 'archive:save an archive'
131 'branch:create a branch'
132 'browse:browse repository'
133 'clone:clone repository'
134 'cola:start git-cola'
135 'config:edit configuration'
136 'dag:visualize branch history'
138 'fetch:fetch remotes'
141 'merge:merge branches'
142 'pull:pull remote branches'
143 'push:push remote branches'
144 'rebase:interactive rebase'
145 'recent:edit recent files'
146 'remote:edit remotes'
147 'search:search commits'
148 'stash:stash and unstash changes'
150 'version:print the version'
151 '--help-commands:show available sub-commands'
154 _describe -t commands git-cola subcommands
158 funcname=_git-cola-$line[1]
159 if type $funcname | grep -q 'shell function'
163 __git-cola_common_options