Skip to content

Commit caf2de3

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent 7e1eeaa commit caf2de3

2 files changed

Lines changed: 9 additions & 20 deletions

File tree

builtin/grep.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
832832
OPT_BOOL('L', "files-without-match",
833833
&opt.unmatch_name_only,
834834
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),
837838
OPT_BOOL('c', "count", &opt.count,
838839
N_("show the number of matches instead of matching lines")),
839840
OPT__COLOR(&opt.color, N_("highlight matches")),
@@ -884,9 +885,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
884885
OPT_GROUP(""),
885886
{ OPTION_STRING, 'O', "open-files-in-pager", &show_in_pager,
886887
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),
890893
OPT_END()
891894
};
892895

contrib/completion/git-completion.bash

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,21 +1565,7 @@ _git_grep ()
15651565

15661566
case "$cur" in
15671567
--*)
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
15831569
return
15841570
;;
15851571
esac

0 commit comments

Comments
 (0)