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:
Edward Langley
2026-04-04 09:31:49 -07:00
parent bfc30cb7b2
commit 9afa13f78a

View File

@ -122,7 +122,7 @@ fn parse_command(segment: &str) -> Result<Command, String> {
"set-cell" => {
if args.len() < 2 {
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])?;
@ -254,7 +254,10 @@ fn parse_command(segment: &str) -> Result<Command, String> {
fn require_args(word: &str, args: &[String], n: usize) -> Result<(), String> {
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 {
Ok(())
}
@ -287,7 +290,9 @@ fn parse_axis(s: &str) -> Result<Axis, String> {
"column" | "col" => Ok(Axis::Column),
"page" => Ok(Axis::Page),
"none" => Ok(Axis::None),
_ => Err(format!("Unknown axis: {s} (expected row, column, page, none)")),
_ => Err(format!(
"Unknown axis: {s} (expected row, column, page, none)"
)),
}
}