improve error formatting
- Added missing comma in error message for set-cell command. - Reformatted error messages for consistency. - Minor formatting changes to improve readability. Co-Authored-By: fiddlerwoaroof/git-smart-commit (gpt-oss:20b)
This commit is contained in:
@ -122,7 +122,7 @@ fn parse_command(segment: &str) -> Result<Command, String> {
|
|||||||
"set-cell" => {
|
"set-cell" => {
|
||||||
if args.len() < 2 {
|
if args.len() < 2 {
|
||||||
return Err(
|
return Err(
|
||||||
"set-cell requires a value and at least one Cat/Item coordinate".to_string()
|
"set-cell requires a value and at least one Cat/Item coordinate".to_string(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let value = parse_cell_value(&args[0])?;
|
let value = parse_cell_value(&args[0])?;
|
||||||
@ -254,7 +254,10 @@ fn parse_command(segment: &str) -> Result<Command, String> {
|
|||||||
|
|
||||||
fn require_args(word: &str, args: &[String], n: usize) -> Result<(), String> {
|
fn require_args(word: &str, args: &[String], n: usize) -> Result<(), String> {
|
||||||
if args.len() < n {
|
if args.len() < n {
|
||||||
Err(format!("{word} requires {n} argument(s), got {}", args.len()))
|
Err(format!(
|
||||||
|
"{word} requires {n} argument(s), got {}",
|
||||||
|
args.len()
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -287,7 +290,9 @@ fn parse_axis(s: &str) -> Result<Axis, String> {
|
|||||||
"column" | "col" => Ok(Axis::Column),
|
"column" | "col" => Ok(Axis::Column),
|
||||||
"page" => Ok(Axis::Page),
|
"page" => Ok(Axis::Page),
|
||||||
"none" => Ok(Axis::None),
|
"none" => Ok(Axis::None),
|
||||||
_ => Err(format!("Unknown axis: {s} (expected row, column, page, none)")),
|
_ => Err(format!(
|
||||||
|
"Unknown axis: {s} (expected row, column, page, none)"
|
||||||
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user