restore cli capabilites
This commit is contained in:
parent
46987e11ad
commit
5f7ab37935
184
src/main.rs
184
src/main.rs
@ -27,10 +27,18 @@ fn main() -> iced::Result {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(second_query) = arg.get(2) {
|
if let Some(second_query) = arg.get(2) {
|
||||||
// if let Some(f) = bible::get( query, second_query, vec![format!("{BIBLE_DIRECTORY}/EnglishNASBBible.xml").into()],
|
if let Ok(contents) = fs::read_to_string(&format!("{BIBLE_DIRECTORY}/EnglishNASBBible.xml")) {
|
||||||
// ) {
|
if let Ok(bible) = quick_xml::de::from_str::<bible::Bible>(&contents) {
|
||||||
// println!("{}", f);
|
if let Some(f) = bible::get(
|
||||||
// }
|
query,
|
||||||
|
second_query,
|
||||||
|
vec![&bible],
|
||||||
|
) {
|
||||||
|
println!("{}", f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,93 +216,93 @@ impl State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Element<Message> {
|
fn view(&self) -> Element<Message> {
|
||||||
scrollable(row![
|
scrollable(
|
||||||
row((0..self.cols).map(|col_index| {
|
row![
|
||||||
column![
|
row((0..self.cols).map(|col_index| {
|
||||||
// header
|
column![
|
||||||
button("Delete Column")
|
// header
|
||||||
.on_press_with(move || Message::DeleteColumn(col_index))
|
button("Delete Column")
|
||||||
.width(Length::Fill)
|
.on_press_with(move || Message::DeleteColumn(col_index))
|
||||||
.style(button::danger)
|
.width(Length::Fill)
|
||||||
,
|
.style(button::danger),
|
||||||
combo_box(
|
combo_box(
|
||||||
&self.files,
|
&self.files,
|
||||||
"Select Bible",
|
"Select Bible",
|
||||||
self.states[col_index].selected_file.as_ref(),
|
self.states[col_index].selected_file.as_ref(),
|
||||||
move |s| Message::BibleSelected(col_index, s)
|
move |s| Message::BibleSelected(col_index, s)
|
||||||
),
|
),
|
||||||
text_input(
|
text_input(
|
||||||
"Search query, ie: Gen 1:1",
|
"Search query, ie: Gen 1:1",
|
||||||
&self.states[col_index].bible_search
|
&self.states[col_index].bible_search
|
||||||
)
|
|
||||||
.on_input(move |s| Message::BibleSearchInput(col_index, s))
|
|
||||||
.on_submit(Message::BibleSearchSubmit(col_index)),
|
|
||||||
widget::text_input("Word Search", &self.states[col_index].word_search)
|
|
||||||
.on_input(move |s| Message::WordSearchInput(col_index, s))
|
|
||||||
.on_submit(Message::SubmitWordSearch(col_index)),
|
|
||||||
row![
|
|
||||||
button("Clear All")
|
|
||||||
.on_press_with(move || Message::Clear(col_index))
|
|
||||||
.style(button::secondary)
|
|
||||||
,
|
|
||||||
button("Copy Scripture")
|
|
||||||
.on_press_with(move || Message::CopyText(col_index))
|
|
||||||
.style(button::primary)
|
|
||||||
,
|
|
||||||
]
|
|
||||||
.spacing(5),
|
|
||||||
row![
|
|
||||||
// Word search results
|
|
||||||
scrollable(
|
|
||||||
column(
|
|
||||||
self.states[col_index]
|
|
||||||
.word_search_results
|
|
||||||
.clone()
|
|
||||||
.unwrap_or(Vec::new())
|
|
||||||
.into_iter()
|
|
||||||
.map(|i| button(text(i.clone()))
|
|
||||||
.on_press_with(move || Message::QuickSearch(
|
|
||||||
col_index,
|
|
||||||
i.to_owned()
|
|
||||||
))
|
|
||||||
.into())
|
|
||||||
)
|
|
||||||
.padding([5, 5])
|
|
||||||
)
|
)
|
||||||
|
.on_input(move |s| Message::BibleSearchInput(col_index, s))
|
||||||
|
.on_submit(Message::BibleSearchSubmit(col_index)),
|
||||||
|
widget::text_input("Word Search", &self.states[col_index].word_search)
|
||||||
|
.on_input(move |s| Message::WordSearchInput(col_index, s))
|
||||||
|
.on_submit(Message::SubmitWordSearch(col_index)),
|
||||||
|
row![
|
||||||
|
button("Clear All")
|
||||||
|
.on_press_with(move || Message::Clear(col_index))
|
||||||
|
.style(button::secondary),
|
||||||
|
button("Copy Scripture")
|
||||||
|
.on_press_with(move || Message::CopyText(col_index))
|
||||||
|
.style(button::primary),
|
||||||
|
]
|
||||||
.spacing(5),
|
.spacing(5),
|
||||||
// Body
|
row![
|
||||||
scrollable(if let Some(body) = &self.states[col_index].scripture_body {
|
// Word search results
|
||||||
column(body.split("\n").enumerate().map(|(i, msg)| {
|
scrollable(
|
||||||
let msg = parse(msg);
|
column(
|
||||||
if i & 1 == 0 {
|
self.states[col_index]
|
||||||
text(msg.to_owned()).color(color![0xFFFFFF]).into()
|
.word_search_results
|
||||||
} else {
|
.clone()
|
||||||
text(msg.to_owned()).color(color![0xAAAAAA]).into()
|
.unwrap_or(Vec::new())
|
||||||
}
|
.into_iter()
|
||||||
}))
|
.map(|i| button(text(i.clone()))
|
||||||
} else {
|
.on_press_with(move || Message::QuickSearch(
|
||||||
column(
|
col_index,
|
||||||
Vec::<String>::new()
|
i.to_owned()
|
||||||
.iter()
|
))
|
||||||
.map(|_| text(String::new()).into()),
|
.into())
|
||||||
|
)
|
||||||
|
.padding([5, 5])
|
||||||
)
|
)
|
||||||
})
|
.spacing(5),
|
||||||
.spacing(5)
|
// Body
|
||||||
],
|
scrollable(
|
||||||
]
|
if let Some(body) = &self.states[col_index].scripture_body {
|
||||||
.spacing(5)
|
column(body.split("\n").enumerate().map(|(i, msg)| {
|
||||||
.width(800.)
|
let msg = parse(msg);
|
||||||
.into()
|
if i & 1 == 0 {
|
||||||
})),
|
text(msg.to_owned()).color(color![0xFFFFFF]).into()
|
||||||
button(text("+").center())
|
} else {
|
||||||
.height(Length::Fixed(200.))
|
text(msg.to_owned()).color(color![0xAAAAAA]).into()
|
||||||
.style(button::primary)
|
}
|
||||||
.on_press(Message::AddColRight)
|
}))
|
||||||
]
|
} else {
|
||||||
// 5 pixles css-like padding
|
column(
|
||||||
.padding([5,5])
|
Vec::<String>::new()
|
||||||
// space elements inside this 5 pixels apart
|
.iter()
|
||||||
.spacing(5)
|
.map(|_| text(String::new()).into()),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.spacing(5)
|
||||||
|
],
|
||||||
|
]
|
||||||
|
.spacing(5)
|
||||||
|
.width(800.)
|
||||||
|
.into()
|
||||||
|
})),
|
||||||
|
button(text("+").center())
|
||||||
|
.height(Length::Fixed(200.))
|
||||||
|
.style(button::primary)
|
||||||
|
.on_press(Message::AddColRight)
|
||||||
|
]
|
||||||
|
// 5 pixles css-like padding
|
||||||
|
.padding([5, 5])
|
||||||
|
// space elements inside this 5 pixels apart
|
||||||
|
.spacing(5),
|
||||||
)
|
)
|
||||||
.direction(Direction::Horizontal(Scrollbar::new()))
|
.direction(Direction::Horizontal(Scrollbar::new()))
|
||||||
.into()
|
.into()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user