diff --git a/src/builtins/fish_indent.rs b/src/builtins/fish_indent.rs index 5d921d7c6..3077e67bd 100644 --- a/src/builtins/fish_indent.rs +++ b/src/builtins/fish_indent.rs @@ -974,7 +974,23 @@ enum OutputType { '\x02' => output_type = OutputType::Ansi, '\x03' => output_type = OutputType::PygmentsCsv, 'c' => output_type = OutputType::Check, - _ => return Err(STATUS_CMD_ERROR), + ';' => { + streams.err.append(wgettext_fmt!( + BUILTIN_ERR_UNEXP_ARG, + "fish_indent", + w.argv[w.wopt_index - 1] + )); + return Err(STATUS_CMD_ERROR); + } + '?' => { + streams.err.append(wgettext_fmt!( + BUILTIN_ERR_UNKNOWN, + "fish_indent", + w.argv[w.wopt_index - 1] + )); + return Err(STATUS_CMD_ERROR); + } + _ => panic!(), } } diff --git a/tests/checks/indent.fish b/tests/checks/indent.fish index ff8dd09da..a6db91e9b 100644 --- a/tests/checks/indent.fish +++ b/tests/checks/indent.fish @@ -2,6 +2,9 @@ # Test file for fish_indent # Note that littlecheck ignores leading whitespace, so we have to use {{ }} to explicitly match it. +fish_indent --no-such-option +#CHECKERR: fish_indent: --no-such-option: unknown option + echo 'echo foo \\ | cat' | $fish_indent #CHECK: echo foo \