Correct error on when complete -C is used without argument

The new --escape option means that -C is not necessarily the last option;
We have this scenario where we produce a bogus error

    $ fish -c 'complete -C --escape'
    complete: --escape: option requires an argument

--escape doesn't take arguments, so let the error message say -C.
This commit is contained in:
Johannes Altmanninger 2022-02-09 08:52:52 +01:00
parent 9e0f74eb6c
commit 210e7a9cc9

View File

@ -357,7 +357,7 @@ maybe_t<int> builtin_complete(parser_t &parser, io_streams_t &streams, const wch
if (!state.initialized) {
// This corresponds to using 'complete -C' in non-interactive mode.
// See #2361 .
builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]);
builtin_missing_argument(parser, streams, cmd, L"-C");
return STATUS_INVALID_ARGS;
}
do_complete_param = std::move(state.text);