summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-11-02 16:53:23 +0900
committerJunio C Hamano <gitster@pobox.com>2023-11-02 16:53:24 +0900
commit2fdfd7594f2ecfe50314ddd0caabc0a84197357e (patch)
treef9a04b09f5285bf3bc8ee20ecba8d2f8f4dd4083
parent18e0648b9b9cc61f4b4bff12c97bf9ef2737b5d5 (diff)
parent2a63c79dae72b25420bc71116bef7436fd846758 (diff)
downloadgit-2fdfd7594f2ecfe50314ddd0caabc0a84197357e.tar.gz
Merge branch 'rs/grep-parseopt-simplify' into maint-2.42
Simplify use of parse-options API a bit. * rs/grep-parseopt-simplify: grep: use OPT_INTEGER_F for --max-depth
-rw-r--r--builtin/grep.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 2a261074f1..b71222330a 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -924,9 +924,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
N_("process binary files with textconv filters")),
OPT_SET_INT('r', "recursive", &opt.max_depth,
N_("search in subdirectories (default)"), -1),
- { OPTION_INTEGER, 0, "max-depth", &opt.max_depth, N_("depth"),
- N_("descend at most <depth> levels"), PARSE_OPT_NONEG,
- NULL, 1 },
+ OPT_INTEGER_F(0, "max-depth", &opt.max_depth,
+ N_("descend at most <n> levels"), PARSE_OPT_NONEG),
OPT_GROUP(""),
OPT_SET_INT('E', "extended-regexp", &opt.pattern_type_option,
N_("use extended POSIX regular expressions"),