From 72c04d11ad3866b1e1b13cccd5ad8058abda5884 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Wed, 3 Nov 2021 22:51:20 -0700 Subject: [PATCH] builtin.cpp: show a short options' - for BUILTIN_ERR_MISSING --- src/builtin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/builtin.cpp b/src/builtin.cpp index f735c2996..9f3abf665 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -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, const wchar_t *opt, bool print_hints) { 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; + // 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) { builtin_print_error_trailer(parser, streams.err, cmd); }