M7: explain the one-based sheet selector requirement (#6699)

Lands #6699 by @MMexicann.

Co-Authored-By: MMexicann <44814932+MMexicann@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Martin Ball
2026-11-28 21:54:37 +00:00
co-authored by MMexicann Claude Opus 5.5
parent 45a851dee2
commit df3279f87e
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -176,7 +176,7 @@ pub(super) fn recipients(s: &mut Session, v: &Value) -> CmdResult {
}
Pick::Index(0)
}
Some(_) => return Err(CmdError::Params("`sheet` must be a sheet name or number".into())),
Some(_) => return Err(CmdError::Params("`sheet` must be a sheet name or positive integer (1 = the first sheet)".into())),
};
let (names, rows) = read_rows(&bytes, pick).map_err(CmdError::Failed)?;
let chosen = match pick {
+4 -1
View File
@@ -242,7 +242,10 @@ fn recipients_from_a_workbook_ask_for_the_sheet_when_there_are_several() {
assert_eq!(r["fields"], json!(["Column 1", "Column 2", "Column 3"]));
assert_eq!(r["records"], 3);
assert!(s.run("mailings.recipients", &json!({"data": data, "sheet": 3})).is_err());
assert!(s.run("mailings.recipients", &json!({"data": data, "sheet": 0})).is_err());
assert!(matches!(
s.run("mailings.recipients", &json!({"data": data, "sheet": 0})),
Err(CmdError::Params(message)) if message == "`sheet` must be a sheet name or positive integer (1 = the first sheet)"
));
assert!(s.run("mailings.recipients", &json!({"data": "%%%"})).is_err());
}