range-diff: indent the diffs just like tbdiff
[gitweb.git] / builtin / grep.c
index 538a818e6dd63cd0825bb6c1b195e49bad9442b9..056161f0f88596a6074ef6edddeaa6c894d8b801 100644 (file)
@@ -829,6 +829,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                            GREP_PATTERN_TYPE_PCRE),
                OPT_GROUP(""),
                OPT_BOOL('n', "line-number", &opt.linenum, N_("show line numbers")),
+               OPT_BOOL(0, "column", &opt.columnnum, N_("show column number of first match")),
                OPT_NEGBIT('h', NULL, &opt.pathname, N_("don't show filenames"), 1),
                OPT_BIT('H', NULL, &opt.pathname, N_("show filenames"), 1),
                OPT_NEGBIT(0, "full-name", &opt.relative,
@@ -843,6 +844,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                OPT_BOOL_F('z', "null", &opt.null_following_name,
                           N_("print NUL after filenames"),
                           PARSE_OPT_NOCOMPLETE),
+               OPT_BOOL('o', "only-matching", &opt.only_matching,
+                       N_("show only matching parts of a line")),
                OPT_BOOL('c', "count", &opt.count,
                        N_("show the number of matches instead of matching lines")),
                OPT__COLOR(&opt.color, N_("highlight matches")),
@@ -962,6 +965,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
        if (!opt.pattern_list)
                die(_("no pattern given."));
 
+       /* --only-matching has no effect with --invert. */
+       if (opt.invert)
+               opt.only_matching = 0;
+
        /*
         * We have to find "--" in a separate pass, because its presence
         * influences how we will parse arguments that come before it.