grep: color patterns in output
Coloring matches makes them easier to spot in the output. Add two options and two parameters: color.grep (to turn coloring on or off), color.grep.match (to set the color of matches), --color and --no-color (to turn coloring on or off, respectively). The output of external greps is not changed. This patch is based on earlier ones by Nguyễn Thái Ngọc Duy and Thiago Alves. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
79212772ce
commit
7e8f59d577
3
grep.h
3
grep.h
@ -1,5 +1,6 @@
|
||||
#ifndef GREP_H
|
||||
#define GREP_H
|
||||
#include "color.h"
|
||||
|
||||
enum grep_pat_token {
|
||||
GREP_PATTERN,
|
||||
@ -77,6 +78,8 @@ struct grep_opt {
|
||||
unsigned relative:1;
|
||||
unsigned pathname:1;
|
||||
unsigned null_following_name:1;
|
||||
int color;
|
||||
char color_match[COLOR_MAXLEN];
|
||||
int regflags;
|
||||
unsigned pre_context;
|
||||
unsigned post_context;
|
||||
|
Reference in New Issue
Block a user