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

Re: [PATCH] Add an optional argument for --color options

From
Jeff King <peff@peff.net>
Date
Feb 15, 2010, 05:23 UTC
Message-ID
<20100215052356.GI3336@coredump.intra.peff.net>
In-Reply-To
<20100215011803.GA15966@progeny.tock>
On Sun, Feb 14, 2010 at 07:18:04PM -0600, Jonathan Nieder wrote:
Show 7 quoted lines
> > Perhaps I can throw the tests in Jonathan's "tests for automatic use
> > of pager", t7006-pager?  Or, create a new test that mimics his?
> 
> I would suggest copying whatever functions you need to a new
> lib-terminal.sh and sourcing that with . from a new test.  Then I
> could adapt t7006-pager to use your library and avoid duplication of
> code.
Yes, I think that is a reasonable way to go.
> I am also interested in feedback on the techniques used in that test.
> Should it just rely on redirects to /dev/tty instead, and work to
> avoid sending any actual output there?  Is there an easier way to
> detect use of color?

Keep in mind that you might not even have a terminal at all (e.g., tests run from a cron job), so redirecting /dev/tty won't help there. It is easy enough to fake, as I posted in the other thread, so I think that is probably simplest (unless we go with the "it only works under --verbose" scheme).

-Peff
Previous: Jonathan NiederNext: Jonathan Nieder
Message 6 of 11 in “Add an optional argument for --color options”
  1. Add an optional argument for --color optionsMark Lodato, Feb 13, 2010
  2. Jeff KingFeb 14, 2010
  3. Jonathan NiederFeb 14, 2010
  4. Mark LodatoFeb 14, 2010
  5. Jonathan NiederFeb 15, 2010
  6. Jeff KingFeb 15, 2010
  7. Usage messages produced by parseopt (Re: [PATCH] Add an optional argument for --color options)Jonathan Nieder, Feb 15, 2010
  8. Jeff KingFeb 15, 2010
  9. Junio C HamanoFeb 15, 2010
  10. Junio C HamanoFeb 14, 2010
  11. Mark LodatoFeb 14, 2010

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.