mirror of
https://github.com/git/git
synced 2024-08-27 03:29:21 +00:00
completion: add GIT_COMPLETION_SHOW_ALL env var
When set to 1, GIT_COMPLETION_SHOW_ALL causes --git-completion-helper-all to be passed instead of --git-completion-helper. Signed-off-by: Ryan Zoeller <rtzoeller@rtzoeller.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a0abe5e3b7
commit
c099f579b9
|
@ -39,6 +39,11 @@
|
||||||
# When set to "1", do not include "DWIM" suggestions in git-checkout
|
# When set to "1", do not include "DWIM" suggestions in git-checkout
|
||||||
# and git-switch completion (e.g., completing "foo" when "origin/foo"
|
# and git-switch completion (e.g., completing "foo" when "origin/foo"
|
||||||
# exists).
|
# exists).
|
||||||
|
#
|
||||||
|
# GIT_COMPLETION_SHOW_ALL
|
||||||
|
#
|
||||||
|
# When set to "1" suggest all options, including options which are
|
||||||
|
# typically hidden (e.g. '--allow-empty' for 'git commit').
|
||||||
|
|
||||||
case "$COMP_WORDBREAKS" in
|
case "$COMP_WORDBREAKS" in
|
||||||
*:*) : great ;;
|
*:*) : great ;;
|
||||||
|
@ -411,10 +416,17 @@ __gitcomp_builtin ()
|
||||||
local options
|
local options
|
||||||
eval "options=\${$var-}"
|
eval "options=\${$var-}"
|
||||||
|
|
||||||
|
local completion_helper
|
||||||
|
if [ "$GIT_COMPLETION_SHOW_ALL" = "1" ]; then
|
||||||
|
completion_helper="--git-completion-helper-all"
|
||||||
|
else
|
||||||
|
completion_helper="--git-completion-helper"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$options" ]; then
|
if [ -z "$options" ]; then
|
||||||
# leading and trailing spaces are significant to make
|
# leading and trailing spaces are significant to make
|
||||||
# option removal work correctly.
|
# option removal work correctly.
|
||||||
options=" $incl $(__git ${cmd/_/ } --git-completion-helper) " || return
|
options=" $incl $(__git ${cmd/_/ } $completion_helper) " || return
|
||||||
|
|
||||||
for i in $excl; do
|
for i in $excl; do
|
||||||
options="${options/ $i / }"
|
options="${options/ $i / }"
|
||||||
|
|
Loading…
Reference in a new issue