diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-12-05 17:26:11 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-12-05 17:57:11 -0800 |
commit | 0f6f5a4022de5904926cd528c681468e3f635256 (patch) | |
tree | ee37c3b7e05ff21f223508ce71ff3cc3f862f32e /Documentation/git-config.txt | |
parent | cec99d8cef12d18c71b277a4cd6963d37b13e901 (diff) | |
download | git-0f6f5a4022de5904926cd528c681468e3f635256.tar.gz |
git config --get-colorbool
This adds an option to help scripts find out color settings from
the configuration file.
git config --get-colorbool color.diff
inspects color.diff variable, and exits with status 0 (i.e. success) if
color is to be used. It exits with status 1 otherwise.
If a script wants "true"/"false" answer to the standard output of the
command, it can pass an additional boolean parameter to its command
line, telling if its standard output is a terminal, like this:
git config --get-colorbool color.diff true
When called like this, the command outputs "true" to its standard output
if color is to be used (i.e. "color.diff" says "always", "auto", or
"true"), and "false" otherwise.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-config.txt')
-rw-r--r-- | Documentation/git-config.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt index 7640450787..98509b4f44 100644 --- a/Documentation/git-config.txt +++ b/Documentation/git-config.txt @@ -21,6 +21,7 @@ SYNOPSIS 'git-config' [<file-option>] --remove-section name 'git-config' [<file-option>] [-z|--null] -l | --list 'git-config' [<file-option>] --get-color name [default] +'git-config' [<file-option>] --get-colorbool name [stdout-is-tty] DESCRIPTION ----------- @@ -135,6 +136,15 @@ See also <<FILES>>. output without getting confused e.g. by values that contain line breaks. +--get-colorbool name [stdout-is-tty]:: + + Find the color setting for `name` (e.g. `color.diff`) and output + "true" or "false". `stdout-is-tty` should be either "true" or + "false", and is taken into account when configuration says + "auto". If `stdout-is-tty` is missing, then checks the standard + output of the command itself, and exits with status 0 if color + is to be used, or exits with status 1 otherwise. + --get-color name default:: Find the color configured for `name` (e.g. `color.diff.new`) and |