From 73e9da019655261e456ed862340880de365111f0 Mon Sep 17 00:00:00 2001 From: Mark Lodato Date: Tue, 16 Feb 2010 23:55:58 -0500 Subject: Add an optional argument for --color options Make git-branch, git-show-branch, git-grep, and all the diff-based programs accept an optional argument for --color. The argument is a colorbool: "always", "never", or "auto". If no argument is given, "always" is used; --no-color is an alias for --color=never. This makes the command-line interface consistent with other GNU tools, such as `ls' and `grep', and with the git-config color options. Note that, without an argument, --color and --no-color work exactly as before. To implement this, two internal changes were made: 1. Allow the first argument of git_config_colorbool() to be NULL, in which case it returns -1 if the argument isn't "always", "never", or "auto". 2. Add OPT_COLOR_FLAG(), OPT__COLOR(), and parse_opt_color_flag_cb() to the option parsing library. The callback uses git_config_colorbool(), so color.h is now a dependency of parse-options.c. Signed-off-by: Mark Lodato Signed-off-by: Junio C Hamano --- Documentation/git-show-branch.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Documentation/git-show-branch.txt') diff --git a/Documentation/git-show-branch.txt b/Documentation/git-show-branch.txt index 734336119c..519f9e1dd7 100644 --- a/Documentation/git-show-branch.txt +++ b/Documentation/git-show-branch.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'git show-branch' [-a|--all] [-r|--remotes] [--topo-order | --date-order] - [--current] [--color | --no-color] [--sparse] + [--current] [--color[=] | --no-color] [--sparse] [--more= | --list | --independent | --merge-base] [--no-name | --sha1-name] [--topics] [ | ]... @@ -117,13 +117,15 @@ OPTIONS When no explicit parameter is given, it defaults to the current branch (or `HEAD` if it is detached). ---color:: +--color[=]:: Color the status sign (one of these: `*` `!` `+` `-`) of each commit corresponding to the branch it's in. + The value must be always (the default), never, or auto. --no-color:: Turn off colored output, even when the configuration file gives the default to color output. + Same as `--color=never`. Note that --more, --list, --independent and --merge-base options are mutually exclusive. -- cgit v1.2.3