fixed error messages in shopt.rs
This commit is contained in:
37
src/shopt.rs
37
src/shopt.rs
@@ -187,7 +187,7 @@ impl ShOptCore {
|
|||||||
let Ok(val) = val.parse::<usize>() else {
|
let Ok(val) = val.parse::<usize>() else {
|
||||||
return Err(ShErr::simple(
|
return Err(ShErr::simple(
|
||||||
ShErrKind::SyntaxErr,
|
ShErrKind::SyntaxErr,
|
||||||
"shopt: expected a positive integer for hist_ignore_dupes value",
|
"shopt: expected a positive integer for max_hist value",
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
self.max_hist = val;
|
self.max_hist = val;
|
||||||
@@ -210,16 +210,12 @@ impl ShOptCore {
|
|||||||
};
|
};
|
||||||
self.auto_hist = val;
|
self.auto_hist = val;
|
||||||
}
|
}
|
||||||
"bell_style" => {
|
"bell_enabled" => {
|
||||||
let Ok(val) = val.parse::<bool>() else {
|
let Ok(val) = val.parse::<bool>() else {
|
||||||
return Err(
|
return Err(
|
||||||
ShErr::simple(
|
ShErr::simple(
|
||||||
ShErrKind::SyntaxErr,
|
ShErrKind::SyntaxErr,
|
||||||
"shopt: expected a bell style for bell_style value",
|
"shopt: expected 'true' or 'false' for bell_enabled value",
|
||||||
)
|
|
||||||
.with_note(
|
|
||||||
Note::new("bell_style takes these options as values")
|
|
||||||
.with_sub_notes(vec!["audible", "visible", "disable"]),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -249,7 +245,7 @@ impl ShOptCore {
|
|||||||
"max_hist",
|
"max_hist",
|
||||||
"interactive_comments",
|
"interactive_comments",
|
||||||
"auto_hist",
|
"auto_hist",
|
||||||
"bell_style",
|
"bell_enabled",
|
||||||
"max_recurse_depth",
|
"max_recurse_depth",
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
@@ -300,7 +296,7 @@ impl ShOptCore {
|
|||||||
output.push_str(&format!("{}", self.auto_hist));
|
output.push_str(&format!("{}", self.auto_hist));
|
||||||
Ok(Some(output))
|
Ok(Some(output))
|
||||||
}
|
}
|
||||||
"bell_style" => {
|
"bell_enabled" => {
|
||||||
let mut output = String::from("Whether or not to allow fern to trigger the terminal bell");
|
let mut output = String::from("Whether or not to allow fern to trigger the terminal bell");
|
||||||
output.push_str(&format!("{}", self.bell_enabled));
|
output.push_str(&format!("{}", self.bell_enabled));
|
||||||
Ok(Some(output))
|
Ok(Some(output))
|
||||||
@@ -324,7 +320,7 @@ impl ShOptCore {
|
|||||||
"max_hist",
|
"max_hist",
|
||||||
"interactive_comments",
|
"interactive_comments",
|
||||||
"auto_hist",
|
"auto_hist",
|
||||||
"bell_style",
|
"bell_enabled",
|
||||||
"max_recurse_depth",
|
"max_recurse_depth",
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
@@ -492,19 +488,18 @@ impl ShOptPrompt {
|
|||||||
_ => Err(
|
_ => Err(
|
||||||
ShErr::simple(
|
ShErr::simple(
|
||||||
ShErrKind::SyntaxErr,
|
ShErrKind::SyntaxErr,
|
||||||
format!("shopt: Unexpected 'core' option '{query}'"),
|
format!("shopt: Unexpected 'prompt' option '{query}'"),
|
||||||
)
|
)
|
||||||
.with_note(Note::new("options can be accessed like 'core.option_name'"))
|
.with_note(Note::new(
|
||||||
|
"options can be accessed like 'prompt.option_name'",
|
||||||
|
))
|
||||||
.with_note(
|
.with_note(
|
||||||
Note::new("'core' contains the following options").with_sub_notes(vec![
|
Note::new("'prompt' contains the following options").with_sub_notes(vec![
|
||||||
"dotglob",
|
"trunc_prompt_path",
|
||||||
"autocd",
|
"edit_mode",
|
||||||
"hist_ignore_dupes",
|
"comp_limit",
|
||||||
"max_hist",
|
"highlight",
|
||||||
"interactive_comments",
|
"tab_stop",
|
||||||
"auto_hist",
|
|
||||||
"bell_style",
|
|
||||||
"max_recurse_depth",
|
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user