gitcfg: use (str, object) signals for {repo,user}_config_changed
[git-cola.git] / contrib / git-cola-completion.bash
blobba28d3a6f362021d81a8458066e0673ea37321a8
1 # This is a git-cola extension for Git's git-completion.bash script
3 # This script must be sourced *after* Git's git-completion.bash script.
4 # See git.git's contrib/completion/git-completion.bash for details.
6 # Completion is provided for "git cola ..." and "git dag ..." via the
7 # _git_cola() and _git_dag() functions.
9 __git_cola_common_options="--prompt --repo --version"
10 __git_cola_subcommands_list=
12 __git_cola_common_opts () {
13 __gitcomp "$__git_cola_common_options $1"
16 _git_cola () {
17 __git_has_doubledash && return
19 if test -z "$__git_cola_subcommands_list"
20 then
21 __git_cola_subcommands_list=$(
22 git cola --help-commands |
23 grep '^ [a-z]' |
24 grep -v cola |
25 cut -d' ' -f5)
28 local subcommand=$(__git_find_on_cmdline "$__git_cola_subcommands_list")
30 case "$prev" in
31 --repo)
32 return
34 esac
36 if test -z "$subcommand"
37 then
38 __gitcomp "
39 $__git_cola_subcommands_list
40 $__git_cola_common_options
41 --amend
42 --help-commands
43 --status-filter
45 return
48 case "$subcommand" in
49 am)
50 return
52 dag)
53 _git_dag "$@"
54 return
56 archive|diff|merge)
57 __git_complete_revlist
58 __git_cola_common_opts
60 grep)
61 # do nothing
63 pull)
64 __git_cola_common_opts --rebase
66 rebase)
67 case "$prev" in
68 --exec)
69 return
71 --whitespace)
72 __gitcomp "nowarn warn fix error error-all"
73 return
75 --strategy)
76 __gitcomp "resolve recursive octopus ours subtree"
77 return
79 --strategy-option)
80 __gitcomp "ours theirs patience
81 diff-algorithm=patience
82 diff-algorithm=minimal
83 diff-algorithm=histogram
84 diff-algorithm=myers
85 ignore-all-space
86 ignore-space-at-eol
87 ignore-space-change
88 renormalize
89 no-renormalize
90 rename-threshold=
91 subtree=
93 return
95 esac
97 __git_complete_revlist
98 __git_cola_common_opts "
99 --abort
100 --autostash
101 --autosquash
102 --committer-date-is-author-date
103 --continue
104 --ignore-date
105 --ignore-whitespace
106 --edit-todo
107 --exec
108 --force-rebase
109 --fork-point
110 --merge
111 --no-autosquash
112 --no-ff
113 --no-stat
114 --onto
115 --preserve-merges
116 --quiet
117 --rerere-autoupdate
118 --root
119 --skip
120 --stat
121 --stop
122 --strategy
123 --strategy-option
124 --verbose
125 --verify
126 --whitespace
129 tag)
130 case "$cword" in
132 # do nothing
135 __git_complete_revlist
137 esac
140 __git_cola_common_opts
142 esac
145 _git_dag () {
146 __git_has_doubledash && return
148 if test "$prev" = "--max-count"
149 then
150 return
152 __git_cola_common_opts --max-count
153 __git_complete_revlist