mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
string: Error out on match -eq
The `--entire` would enable output even though the `--quiet` should have silenced it. These two don't make any sense together so print an error, because the user could have just left off the `-q`.
This commit is contained in:
parent
d579964c7d
commit
66938d206a
2 changed files with 10 additions and 0 deletions
|
@ -864,6 +864,12 @@ static int string_match(parser_t &parser, io_streams_t &streams, int argc, wchar
|
||||||
return STATUS_INVALID_ARGS;
|
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<string_matcher_t> matcher;
|
std::unique_ptr<string_matcher_t> matcher;
|
||||||
if (opts.regex) {
|
if (opts.regex) {
|
||||||
matcher = make_unique<pcre2_matcher_t>(cmd, pattern, opts, streams);
|
matcher = make_unique<pcre2_matcher_t>(cmd, pattern, opts, streams);
|
||||||
|
|
|
@ -559,3 +559,7 @@ function dualcollect
|
||||||
end
|
end
|
||||||
count (dualcollect)
|
count (dualcollect)
|
||||||
# CHECK: 3
|
# CHECK: 3
|
||||||
|
|
||||||
|
string match -qer asd asd
|
||||||
|
# CHECKERR: match: Invalid combination of options,
|
||||||
|
# CHECKERR: --entire and --quiet are mutually exclusive
|
||||||
|
|
Loading…
Reference in a new issue