mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 09:12:11 +08:00
set_color: Don't error with "-b" and no argument
We already don't print an error with just `set_color`, so it should be consistent. Fixes #7154 (also removes an impossible exit)
This commit is contained in:
parent
f0580b4970
commit
86a6a205e7
@ -137,7 +137,8 @@ int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
return STATUS_CMD_OK;
|
||||
}
|
||||
case ':': {
|
||||
builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]);
|
||||
// We don't error here because "-b" is the only option that requires an argument,
|
||||
// and we don't error for missing colors.
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
case '?': {
|
||||
@ -160,12 +161,6 @@ int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
fgcolors.push_back(fg);
|
||||
}
|
||||
|
||||
if (fgcolors.empty() && bgcolor == nullptr && !bold && !underline && !italics && !dim &&
|
||||
!reverse) {
|
||||
streams.err.append_format(_(L"%ls: Expected an argument\n"), argv[0]);
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
// #1323: We may have multiple foreground colors. Choose the best one. If we had no foreground
|
||||
// color, we'll get none(); if we have at least one we expect not-none.
|
||||
const rgb_color_t fg = best_color(fgcolors, output_get_color_support());
|
||||
|
Loading…
x
Reference in New Issue
Block a user