From d77c465d23b07ec57318deb77710003a27d12b58 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 4 Nov 2019 17:33:37 +0100 Subject: [PATCH] string: Allow `-eq` again Instead of forbidding it for both modes, allow it for both and make it quiet for string. Fixes #6282 --- src/builtin_string.cpp | 8 +------- tests/checks/string.fish | 8 ++++++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/builtin_string.cpp b/src/builtin_string.cpp index f5cc6f971..d464a18e4 100644 --- a/src/builtin_string.cpp +++ b/src/builtin_string.cpp @@ -750,7 +750,7 @@ class pcre2_matcher_t : public string_matcher_t { return 0; } - if (opts.entire) { + if (opts.entire && !opts.quiet) { streams.out.append(arg); streams.out.push_back(L'\n'); } @@ -864,12 +864,6 @@ static int string_match(parser_t &parser, io_streams_t &streams, int argc, wchar return STATUS_INVALID_ARGS; } - if (opts.entire && opts.quiet) { - streams.err.append_format(BUILTIN_ERR_COMBO2, cmd, - _(L"--entire and --quiet are mutually exclusive")); - return STATUS_INVALID_ARGS; - } - std::unique_ptr matcher; if (opts.regex) { matcher = make_unique(cmd, pattern, opts, streams); diff --git a/tests/checks/string.fish b/tests/checks/string.fish index a82b15883..dc3eb6e84 100644 --- a/tests/checks/string.fish +++ b/tests/checks/string.fish @@ -561,5 +561,9 @@ count (dualcollect) # CHECK: 3 string match -qer asd asd -# CHECKERR: match: Invalid combination of options, -# CHECKERR: --entire and --quiet are mutually exclusive +echo $status +# CHECK: 0 + +string match -eq asd asd +echo $status +# CHECK: 0