Re: [PATCH] Add an optional argument for --color options
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Feb 15, 2010, 01:18 UTC
- Message-ID
- <20100215011803.GA15966@progeny.tock>
- In-Reply-To
- <ca433831002140658r30aa539fy5480cae8298d6d6c@mail.gmail.com>
Mark Lodato wrote:
> Just wondering, why does diff use a separate option parsing mechanism > than the rest of the code? Would it be worthwhile to switch to > parse_opt?
Historical reasons, I think. And yes. ;-)
> 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.
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?
Jonathan