From: "Øystein Walle" <oystwa@gmail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH 2/4] git-prompt.sh: refactor colored prompt code
Date: Sat, 22 Jun 2013 14:37:03 +0000 (UTC) [thread overview]
Message-ID: <loom.20130622T162818-125@post.gmane.org> (raw)
In-Reply-To: 354a860e12a3463ce5d031c0dc46d095841f717d.1371780085.git.erdavila@gmail.com
Eduardo R. D'Avila <erdavila <at> 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_lblue='\e[1;34m'
> - local c_clear='\e[0m'
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_clear='\['"$(tput sgr0)"'\]'
which is technically cleaner, if not visually.
The problem with that approach is that tput will be run several times for
each prompt, so it would be best if the color variables were global. Another
thing is that you rely on tput being available.
Øsse
next prev parent reply other threads:[~2013-06-22 14:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-21 2:25 [PATCH 0/4] git-prompt: cleaning and improvement Eduardo R. D'Avila
2013-06-21 2:25 ` [PATCH 1/4] t9903: add tests for git-prompt pcmode Eduardo R. D'Avila
2013-06-22 13:06 ` SZEDER Gábor
2013-06-22 16:32 ` Eduardo D'Avila
2013-06-23 7:39 ` Junio C Hamano
2013-06-24 16:21 ` SZEDER Gábor
2013-06-21 2:25 ` [PATCH 2/4] git-prompt.sh: refactor colored prompt code Eduardo R. D'Avila
2013-06-22 14:37 ` Øystein Walle [this message]
2013-06-22 16:45 ` Eduardo D'Avila
2013-06-23 14:51 ` SZEDER Gábor
2013-06-25 1:21 ` Eduardo R. D'Avila
2013-06-21 2:25 ` [PATCH 3/4] git-prompt.sh: do not print duplicate clean color code Eduardo R. D'Avila
2013-06-22 13:26 ` SZEDER Gábor
2013-06-21 2:25 ` [PATCH 4/4] git-prompt.sh: add missing information in comments Eduardo R. D'Avila
2013-06-22 13:40 ` SZEDER Gábor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20130622T162818-125@post.gmane.org \
--to=oystwa@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).