threads / discuss / 48393

completion troubles with bash

Subject: completion troubles with bash

## tl;dr

2 messages between May 1, 2018 and May 1, 2018.

replies: 1people: 2as markdown or json

Pascal Bourdier· May 1, 2018, 12:17 UTC · lore
Hi,

If "GREP_OPTIONS" is set to '--color=always' , then the git completion send some escape characters like this :

^[[1;35;40m^[[K d^[[m^[[Kiff-files mergetool a^[[m^[[Kdd d^[[m^[[Kiff-index mv a^[[m^[[Kddremove d^[[m^[[Kiff-tree name-rev a^[[m^[[Km d^[[m^[[Kifftool notes ...

So you could find a small patch to disable color with "grep" in attachment.
Regards,
Pascal Bourdier
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b09c8a236..0bc55b9ee 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -837,7 +837,7 @@ __git_commands () {
 	then
 		printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}"
 	else
-		git help -a|egrep '^  [a-zA-Z0-9]'
+		git help -a|egrep --color=never '^  [a-zA-Z0-9]'
 	fi
 }
 
Duy Nguyen· May 1, 2018, 12:26 UTC · re: Pascal Bourdier · lore

Re: completion troubles with bash

On Tue, May 1, 2018 at 2:17 PM, Pascal Bourdier <pascal.bourdier@gmail.com> wrote:

Show 14 quoted lines
> Hi,
>
>
> If "GREP_OPTIONS" is set to '--color=always' , then the git completion
> send some escape characters like this :
>
> ^[[1;35;40m^[[K                  d^[[m^[[Kiff-files               mergetool
> a^[[m^[[Kdd                      d^[[m^[[Kiff-index               mv
> a^[[m^[[Kddremove                d^[[m^[[Kiff-tree                name-rev
> a^[[m^[[Km                       d^[[m^[[Kifftool                 notes
> ...
>
>
> So you could find a small patch to disable color with "grep" in attachment.

Yep. The topic 'nd/command-list' on 'pu' accidentally fixes this too since it removes the use of egrep.

Show 6 quoted lines
>
>
> Regards,
>
>
> Pascal Bourdier
-- 
Duy

← back to recent threads