Re: [PATCH 2/4] git-prompt.sh: refactor colored prompt code

2013-06-24 Thread Eduardo R. D'Avila
2013/6/23 SZEDER Gábor : > I'm wary of relying on tput's availability. It's part of ncurses, > which is an essential package in many (most? all?) linux distros, but > I don't know how it is with other supported platforms. So I think > we'd have to stick to the hard-coded escape sequences as a fal

Re: [PATCH 2/4] git-prompt.sh: refactor colored prompt code

2013-06-23 Thread SZEDER Gábor
On Sat, Jun 22, 2013 at 01:45:38PM -0300, Eduardo D'Avila wrote: > 2013/6/22 Øystein Walle : > > I've gotten the impression it's better to use tput to generate the escape > > sequences instead of hardcoding them. So something like: > > > > local c_red='\['"$(tput setaf 1)"'\]' > > local c_green='\[

Re: [PATCH 2/4] git-prompt.sh: refactor colored prompt code

2013-06-22 Thread Eduardo D'Avila
2013/6/22 Øystein Walle : > I've gotten the impression it's better to use tput to generate the escape > sequences instead of hardcoding them. So something like: > > local c_red='\['"$(tput setaf 1)"'\]' > local c_green='\['"$(tput setaf 2)"'\]' > local c_green='\['"$(tput setaf 4)"'\]' > local c_cl

Re: [PATCH 2/4] git-prompt.sh: refactor colored prompt code

2013-06-22 Thread Øystein Walle
Eduardo R. D'Avila gmail.com> writes: > + local c_red='\[\e[31m\]' > + local c_green='\[\e[32m\]' > + local c_lblue='\[\e[1;34m\]' > + local c_clear='\[\e[0m\]' > fi > - local c_red='\e[31m' > - local c_green='\e[32m' > - local c_l

[PATCH 2/4] git-prompt.sh: refactor colored prompt code

2013-06-20 Thread Eduardo R. D'Avila
__git_ps1_colorize_gitstring() sets color codes and builds the prompt gitstring. It has duplicated code to handle color codes for bash and zsh shells. __git_ps1() also has duplicated logic to build the prompt gitstring. Remove duplication of logic to build gitstring in __git_ps1_colorize_gitstring