mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 18:51:15 -03:00
fish_indent: handle invalid arguments
This commit is contained in:
@@ -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!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user