File: git-cola-completion.bash

package info (click to toggle)
git-cola 4.14.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 6,812 kB
  • sloc: python: 37,625; sh: 298; makefile: 223; xml: 102; tcl: 62
file content (157 lines) | stat: -rw-r--r-- 2,731 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# git-cola extensions for Git's git-completion.bash script
#
# This script must be sourced *after* Git's git-completion.bash script.
# Source git.git's git-completion.bash and then source this script from
# your ~/.bashrc in order to activate the completions.
#
# Completion is provided for "git cola ..." and "git dag ..." via the
# _git_cola() and _git_dag() functions.
# See git.git's contrib/completion/git-completion.bash for more details.

__git_cola_common_options="--icon-theme --prompt --repo --theme --version"
__git_cola_subcommands_list=

__git_cola_common_opts () {
	__gitcomp "$__git_cola_common_options $1"
}

_git_cola () {
	__git_has_doubledash && return

	if test -z "$__git_cola_subcommands_list"
	then
		__git_cola_subcommands_list=$(
			git cola --help-commands |
			grep '^    [a-z]' |
			grep -v cola |
			cut -d' ' -f5)
	fi

	local subcommand=$(__git_find_on_cmdline "$__git_cola_subcommands_list")

	case "$prev" in
	--repo)
		return
		;;
	esac

	if test -z "$subcommand"
	then
		__gitcomp "
			$__git_cola_subcommands_list
			$__git_cola_common_options
			--amend
			--help-commands
			--status-filter
		"
		return
	fi

	case "$subcommand" in
	am)
		return
		;;
	dag)
		_git_dag "$@"
		return
		;;
	archive|diff|merge)
		__git_complete_revlist
		__git_cola_common_opts
		;;
	grep)
		# do nothing
		;;
	pull)
		__git_cola_common_opts --rebase
		;;
	rebase)
		case "$prev" in
		--exec)
			return
			;;
		--whitespace)
			__gitcomp "nowarn warn fix error error-all"
			return
			;;
		--strategy)
			__gitcomp "resolve recursive octopus ours subtree"
			return
			;;
		--strategy-option)
			__gitcomp "ours theirs patience
				diff-algorithm=patience
				diff-algorithm=minimal
				diff-algorithm=histogram
				diff-algorithm=myers
				ignore-all-space
				ignore-space-at-eol
				ignore-space-change
				renormalize
				no-renormalize
				rename-threshold=
				subtree=
				"
			return
			;;
		esac

		__git_complete_revlist
		__git_cola_common_opts "
			--abort
			--autostash
			--autosquash
			--committer-date-is-author-date
			--continue
			--ignore-date
			--ignore-whitespace
			--edit-todo
			--exec
			--force-rebase
			--fork-point
			--merge
			--no-autosquash
			--no-ff
			--no-stat
			--onto
			--preserve-merges
			--quiet
			--rerere-autoupdate
			--root
			--skip
			--stat
			--stop
			--strategy
			--strategy-option
			--update-refs
			--verbose
			--verify
			--whitespace
		"
		;;
	tag)
		case "$cword" in
		3)
			# do nothing
			;;
		*)
			__git_complete_revlist
			;;
		esac
		;;
	*)
		__git_cola_common_opts
		;;
	esac
}

_git_dag () {
	__git_has_doubledash && return

	if test "$prev" = "--max-count"
	then
		return
	fi
	__git_cola_common_opts --max-count
	__git_complete_revlist
}