abbr: Warn when -U is given

This prints a warning to stderr and then still does the thing.

Because of the error trailer, it points to the abbr help page.
This commit is contained in:
Fabian Boehm 2023-01-14 17:21:30 +01:00
parent 5c56fa0e6f
commit da0c640750

View file

@ -393,9 +393,15 @@ maybe_t<int> builtin_abbr(parser_t &parser, io_streams_t &streams, const wchar_t
opts.list = true;
break;
case 'g':
case 'U':
// Kept for backwards compatibility but ignored.
// This basically does nothing now.
break;
case 'U': {
// Kept and made ineffective, so we warn.
streams.err.append_format(_(L"%ls: Warning: Option '%ls' was removed and is now ignored"), cmd, argv[w.woptind - 1]);
builtin_print_error_trailer(parser, streams.err, cmd);
break;
}
case 'h': {
builtin_print_help(parser, streams, cmd);
return STATUS_CMD_OK;