completion: use __gitcomp_builtin in _git_grep
The new completable options are: --after-context= --before-context= --color --context --exclude-standard --quiet --recurse-submodules --textconv Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Feb 9, 2018 at 18:01 UTC
caf2de33905b74a52a0df26214ee9ab555b32bd9
2 files changed
+9
-20
builtin/grep.c
+8
-5
@@ -832,8 +832,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
832
OPT_BOOL('L', "files-without-match",
833
&opt.unmatch_name_only,
834
N_("show only the names of files without match")),
835
- OPT_BOOL('z', "null", &opt.null_following_name,
836
- N_("print NUL after filenames")),
835
+ OPT_BOOL_F('z', "null", &opt.null_following_name,
836
+ N_("print NUL after filenames"),
837
+ PARSE_OPT_NOCOMPLETE),
838
OPT_BOOL('c', "count", &opt.count,
839
N_("show the number of matches instead of matching lines")),
840
OPT__COLOR(&opt.color, N_("highlight matches")),
@@ -884,9 +885,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
885
OPT_GROUP(""),
886
{ OPTION_STRING, 'O', "open-files-in-pager", &show_in_pager,
887
N_("pager"), N_("show matching files in the pager"),
887
- PARSE_OPT_OPTARG, NULL, (intptr_t)default_pager },
888
- OPT_BOOL(0, "ext-grep", &external_grep_allowed__ignored,
889
- N_("allow calling of grep(1) (ignored by this build)")),
888
+ PARSE_OPT_OPTARG | PARSE_OPT_NOCOMPLETE,
889
+ NULL, (intptr_t)default_pager },
890
+ OPT_BOOL_F(0, "ext-grep", &external_grep_allowed__ignored,
891
+ N_("allow calling of grep(1) (ignored by this build)"),
892
+ PARSE_OPT_NOCOMPLETE),
893
OPT_END()
894
};
895
contrib/completion/git-completion.bash
+1
-15
@@ -1565,21 +1565,7 @@ _git_grep ()
1565
1566
case "$cur" in
1567
--*)
1568
- __gitcomp "
1569
- --cached
1570
- --text --ignore-case --word-regexp --invert-match
1571
- --full-name --line-number
1572
- --extended-regexp --basic-regexp --fixed-strings
1573
- --perl-regexp
1574
- --threads
1575
- --files-with-matches --name-only
1576
- --files-without-match
1577
- --max-depth
1578
- --count
1579
- --and --or --not --all-match
1580
- --break --heading --show-function --function-context
1581
- --untracked --no-index
1582
- "
1568
+ __gitcomp_builtin grep
1569
return
1570
;;
1571
esac