summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivano@gnu.org>2015-03-08 22:45:11 +0100
committerJim Meyering <meyering@fb.com>2015-11-29 08:20:53 -0800
commitc0fa19fe92da71404f809aafb5f51cfd99b1bee2 (patch)
tree20f573743b7d02ce463eaa548f25f15b2a3e3213 /doc
parentb4efca9de418c0166f0b106fef068a594b4ab483 (diff)
downloaddiffutils-c0fa19fe92da71404f809aafb5f51cfd99b1bee2.tar.gz
diff: add support for --color
* doc/diffutils.texi (diff Options): Add documentation for --color. Copied from coreutils ls --color. * src/context.c (pr_unidiff_hunk): Set the color context. (print_context_header): Likewise. (pr_context_hunk): Likewise. * src/diff.h (enum colors_style): New enum to record when to use colors. (colors_style): New variable to memorize the argument value. (set_color_context): Add function definition. * src/diff.c: : Define COLOR_OPTION. (specify_colors_style): New function. (longopts): Add --color. (main): Handle --color argument. (option_help_msgid): Add usage string for --color. * src/normal.c (print_normal_hunk): Set the color context. * src/side.c (print_1sdiff_line): Likewise. * src/util.c (print_1_line_nl): New function. (print_1_line): Make it a wrapper of 'print_1_line_nl'. (colors_enabled): New boolean variable. (begin_output): Call check_color_output once the output file is configured. (output_1_line): Periodically call `process_signals'. (caught_signals): New sigset_t. (colors_enabled): New boolean variable. (interrupt_signal): New sig_atomic_t. (stop_signal_count): New sig_atomic_t. (check_color_output): New function. (install_signal_handlers): Likewise. Copied from coreutils ls. (process_signals): Likewise. Copied from coreutils ls. (set_color_context): New function. (sighandler): Likewise. Copied from coreutils ls. (stophandler): Likewise. Copied from coreutils ls.
Diffstat (limited to 'doc')
-rw-r--r--doc/diffutils.texi21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/diffutils.texi b/doc/diffutils.texi
index 091257f..b2c39da 100644
--- a/doc/diffutils.texi
+++ b/doc/diffutils.texi
@@ -3742,6 +3742,27 @@ Read and write data in binary mode. @xref{Binary}.
Use the context output format, showing three lines of context.
@xref{Context Format}.
+@item --color [=@var{when}]
+@cindex color, distinguishing different context
+Specify whether to use color for distinguishing different contexts,
+like header, added or removed lines. @var{when} may be omitted, or
+one of:
+@itemize @bullet
+@item none
+@vindex none @r{color option}
+Do not use color at all. This is the default when no --color option
+is specified.
+@item auto
+@vindex auto @r{color option}
+@cindex terminal, using color iff
+Use color only if standard output is a terminal.
+@item always
+@vindex always @r{color option}
+Always use color.
+@end itemize
+Specifying @option{--color} and no @var{when} is equivalent to
+@option{--color=auto}.
+
@item -C @var{lines}
@itemx --context@r{[}=@var{lines}@r{]}
Use the context output format, showing @var{lines} (an integer) lines of