-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-context-graph-completion.bash
52 lines (47 loc) · 1.61 KB
/
git-context-graph-completion.bash
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
# "lighter" _git_log completion
# See https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
_git_context_graph() {
__git_has_doubledash && return
case "$cur" in
--pretty=* | --format=*)
__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases)
" "" "${cur#*=}"
return
;;
--date=*)
__gitcomp "$__git_log_date_formats" "" "${cur##--date=}"
return
;;
--decorate=*)
__gitcomp "full short no" "" "${cur##--decorate=}"
return
;;
--submodule=*)
__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
return
;;
--*)
__gitcomp "
--add --local --no-default --list --short --usage --config-add --config-clear
--all --branches --tags --remotes
--simplify-merges --simplify-by-decoration
--abbrev-commit --no-abbrev-commit --abbrev=
--relative-date --date=
--pretty= --format= --oneline
--decorate --decorate= --no-decorate
"
return
;;
esac
__git_complete_revlist
}
# Load git completion if not loaded yet and available at usual path
if ! declare -f __git_complete > /dev/null && [ -f /usr/share/bash-completion/completions/git ]; then
. /usr/share/bash-completion/completions/git
fi
# Add completion for aliases
if declare -f __git_complete > /dev/null; then
for a in $(alias -p | grep "git[- ]context-graph" | cut -d' ' -f2 | cut -d= -f1); do
__git_complete "$a" _git_context_graph
done
fi