fixes #4
This commit is contained in:
parent
035bd21466
commit
9c756f3550
@ -129,7 +129,9 @@ pub fn get(book: &str, chap_and_ver: &str, bibles: Vec<&Bible>) -> Result<String
|
||||
.collect::<Vec<(usize, &&str)>>();
|
||||
|
||||
let (book_idx, book_name) = match res.len() {
|
||||
// there is one option for what book it is
|
||||
1 => res[0],
|
||||
// there are >1 options for what book it is
|
||||
2.. => {
|
||||
eprintln!("Err: Ambigious input '{book}', could be any of:");
|
||||
for (_, i) in &res {
|
||||
@ -180,12 +182,15 @@ pub fn get(book: &str, chap_and_ver: &str, bibles: Vec<&Bible>) -> Result<String
|
||||
(Some(sn), Some(en)) => {
|
||||
if let (Ok(start), Ok(end)) = (sn.parse::<usize>(), en.parse::<usize>()) {
|
||||
let mut buf = String::new();
|
||||
|
||||
let translation = &chapters[0].0.translation_name;
|
||||
|
||||
buf += &format!("{style_bold}[{translation}] {style_underline}{book_name}:{start}-{end}{style_reset}\n");
|
||||
for num in start..=end {
|
||||
for (bible, _book, chapter) in &chapters {
|
||||
for (_, _, chapter) in &chapters {
|
||||
if let Some(verse) = chapter.get_verse_by_index(num) {
|
||||
buf += &format!(
|
||||
"{style_bold}[{}] {style_underline}{book_name} {}:{}{style_reset}: {verse}\n",
|
||||
bible.translation_name, chapter.number, verse.number
|
||||
"{}: {verse}\n", verse.number
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user