mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-09 03:51:20 -03:00
Improve name for missing option argument error
This commit is contained in:
@@ -74,12 +74,12 @@ pub fn set_color(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -
|
||||
builtin_print_help(parser, streams, argv[0]);
|
||||
return Ok(SUCCESS);
|
||||
}
|
||||
TextFaceArgsAndOptionsResult::InvalidArgs => {
|
||||
TextFaceArgsAndOptionsResult::MissingOptArg => {
|
||||
// We don't error here because "-b" is the only option that requires an argument,
|
||||
// and we don't error for missing colors.
|
||||
return Err(STATUS_INVALID_ARGS);
|
||||
}
|
||||
TextFaceArgsAndOptionsResult::InvalidUnderlineStyle(arg) => {
|
||||
TextFaceArgsAndOptionsResult::UnknownUnderlineStyle(arg) => {
|
||||
streams.err.append(wgettext_fmt!(
|
||||
"%ls: invalid underline style: %ls\n",
|
||||
argv[0],
|
||||
|
||||
@@ -152,8 +152,8 @@ pub(crate) fn parse_text_face(arguments: &[WString]) -> SpecifiedTextFace {
|
||||
} = match parse_text_face_and_options(&mut argv, /*is_builtin=*/ false) {
|
||||
TextFaceArgsAndOptionsResult::Ok(parsed_text_faces) => parsed_text_faces,
|
||||
TextFaceArgsAndOptionsResult::PrintHelp
|
||||
| TextFaceArgsAndOptionsResult::InvalidArgs
|
||||
| TextFaceArgsAndOptionsResult::InvalidUnderlineStyle(_)
|
||||
| TextFaceArgsAndOptionsResult::MissingOptArg
|
||||
| TextFaceArgsAndOptionsResult::UnknownUnderlineStyle(_)
|
||||
| TextFaceArgsAndOptionsResult::UnknownOption(_) => unreachable!(),
|
||||
};
|
||||
assert!(!print_color_mode);
|
||||
@@ -186,8 +186,8 @@ pub(crate) struct TextFaceArgsAndOptions<'a> {
|
||||
pub(crate) enum TextFaceArgsAndOptionsResult<'a> {
|
||||
Ok(TextFaceArgsAndOptions<'a>),
|
||||
PrintHelp,
|
||||
InvalidArgs,
|
||||
InvalidUnderlineStyle(&'a wstr),
|
||||
MissingOptArg,
|
||||
UnknownUnderlineStyle(&'a wstr),
|
||||
UnknownOption(usize),
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ pub(crate) fn parse_text_face_and_options<'a>(
|
||||
} else if arg == "curly" {
|
||||
style.underline_style = Some(UnderlineStyle::Curly);
|
||||
} else if is_builtin {
|
||||
return TextFaceArgsAndOptionsResult::InvalidUnderlineStyle(arg);
|
||||
return TextFaceArgsAndOptionsResult::UnknownUnderlineStyle(arg);
|
||||
}
|
||||
}
|
||||
'c' => {
|
||||
@@ -251,7 +251,7 @@ pub(crate) fn parse_text_face_and_options<'a>(
|
||||
}
|
||||
':' => {
|
||||
if is_builtin {
|
||||
return TextFaceArgsAndOptionsResult::InvalidArgs;
|
||||
return TextFaceArgsAndOptionsResult::MissingOptArg;
|
||||
}
|
||||
}
|
||||
'?' => {
|
||||
|
||||
Reference in New Issue
Block a user