completion: complete --ws-error-highlight
Add --ws-error-highlight= to the list in __git_diff_common_options, and add the accepted values in a new list __git_ws_error_highlight_opts. Use __git_ws_error_highlight_opts in _git_diff, _git_log and _git_show to offer the accepted values. As noted in fd0bc17557 (completion: add diff --color-moved[-ws], 2020-02-21), there is no easy way to offer completion for several comma-separated values, so this is limited to completing a single value. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Philippe Blain committed
Jun 26, 2023 at 16:24 UTC
da260f61889f0cda3267ca09db3fe48794f52a26
1 file changed
+14
contrib/completion/git-completion.bash
+14
@@ -1733,6 +1733,8 @@ __git_color_moved_opts="no default plain blocks zebra dimmed-zebra"
1733
__git_color_moved_ws_opts="no ignore-space-at-eol ignore-space-change
1734
ignore-all-space allow-indentation-change"
1735
1736
+__git_ws_error_highlight_opts="context old new all default"
1737
+
1738
# Options for the diff machinery (diff, log, show, stash, range-diff, ...)
1739
__git_diff_common_options="--stat --numstat --shortstat --summary
1740
--patch-with-stat --name-only --name-status --color
@@ -1790,6 +1792,10 @@ _git_diff ()
1792
__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
1793
return
1794
;;
1795
+ --ws-error-highlight=*)
1796
+ __gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
1797
+ return
1798
+ ;;
1799
--*)
1800
__gitcomp "$__git_diff_difftool_options"
1801
return
@@ -2080,6 +2086,10 @@ _git_log ()
2086
__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
2087
return
2088
;;
2089
+ --ws-error-highlight=*)
2090
+ __gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
2091
+ return
2092
+ ;;
2093
--no-walk=*)
2094
__gitcomp "sorted unsorted" "" "${cur##--no-walk=}"
2095
return
@@ -3000,6 +3010,10 @@ _git_show ()
3010
__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
3011
return
3012
;;
3013
+ --ws-error-highlight=*)
3014
+ __gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
3015
+ return
3016
+ ;;
3017
--*)
3018
__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
3019
--oneline --show-signature