git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [ANNOUNCE] EasyGit (eg) 0.97

From
Jeff King <peff@peff.net>
Date
Jan 30, 2009, 20:29 UTC
Message-ID
<20090130202917.GA3370@coredump.intra.peff.net>
In-Reply-To
<51419b2c0901301221n45cde1abw7a57a13bfa74b34@mail.gmail.com>
On Fri, Jan 30, 2009 at 01:21:00PM -0700, Elijah Newren wrote:
Show 7 quoted lines
> Whenever I try to load the output in perl, git won't show the
> colorization.  I guess I could manually add it when I am printing the
> information, but it'd be nicer to just have git do the colorization
> despite the fact that its output is not a tty.  Is there an easy way
> to do that (without mucking with the user's config file)?
> 
> (It looks like eg status is also affected, for similar reasons.)

If you pass --color on the command line, it is equivalent to "color = always" (whereas the default is "auto", which turns it on only if output is to a tty).

So you would have to read color.diff yourself and then decide whether to add --color.

Note that in general you are playing things a bit risky with these sorts of outputs. You are calling porcelain (like log and status) and piping it into your program. There's no guarantee that user config might not be affecting the results of those programs.

But I think that is sort of the nature of "eg": to be a thin wrapper around git. So maybe it is OK for your use.

-Peff
Previous: Elijah NewrenNext: Elijah Newren
Message 8 of 10 in “[ANNOUNCE] EasyGit (eg) 0.97”
  1. Elijah NewrenJan 30, 2009
  2. Mike RalphsonJan 30, 2009
  3. Elijah NewrenJan 30, 2009
  4. Jeff KingJan 30, 2009
  5. Jeff KingJan 30, 2009
  6. Elijah NewrenJan 30, 2009
  7. Elijah NewrenJan 30, 2009
  8. Jeff KingJan 30, 2009
  9. Elijah NewrenJan 30, 2009
  10. Jeff KingJan 31, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.