mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
builtin.cpp: show a short options' - for BUILTIN_ERR_MISSING
This commit is contained in:
parent
710639f5d6
commit
72c04d11ad
@ -176,9 +176,14 @@ void builtin_unknown_option(parser_t &parser, io_streams_t &streams, const wchar
|
|||||||
void builtin_missing_argument(parser_t &parser, io_streams_t &streams, const wchar_t *cmd,
|
void builtin_missing_argument(parser_t &parser, io_streams_t &streams, const wchar_t *cmd,
|
||||||
const wchar_t *opt, bool print_hints) {
|
const wchar_t *opt, bool print_hints) {
|
||||||
if (opt[0] == L'-' && opt[1] != L'-') {
|
if (opt[0] == L'-' && opt[1] != L'-') {
|
||||||
|
// if c in -qc '-qc' is missing the argument, now opt is just 'c'
|
||||||
opt += std::wcslen(opt) - 1;
|
opt += std::wcslen(opt) - 1;
|
||||||
|
// now prepend - to output -c
|
||||||
|
streams.err.append_format(BUILTIN_ERR_MISSING, cmd, wcstring(L"-").append(opt).c_str());
|
||||||
}
|
}
|
||||||
streams.err.append_format(BUILTIN_ERR_MISSING, cmd, opt);
|
else
|
||||||
|
streams.err.append_format(BUILTIN_ERR_MISSING, cmd, opt);
|
||||||
|
|
||||||
if (print_hints) {
|
if (print_hints) {
|
||||||
builtin_print_error_trailer(parser, streams.err, cmd);
|
builtin_print_error_trailer(parser, streams.err, cmd);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user