restore cli capabilites
This commit is contained in:
		
							
								
								
									
										36
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								src/main.rs
									
									
									
									
									
								
							@@ -27,10 +27,18 @@ fn main() -> iced::Result {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if let Some(second_query) = arg.get(2) {
 | 
			
		||||
            // if let Some(f) = bible::get( query, second_query, vec![format!("{BIBLE_DIRECTORY}/EnglishNASBBible.xml").into()],
 | 
			
		||||
            // ) {
 | 
			
		||||
            //   println!("{}", f);
 | 
			
		||||
            // }
 | 
			
		||||
            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) {
 | 
			
		||||
                    if let Some(f) = bible::get(
 | 
			
		||||
                        query,
 | 
			
		||||
                        second_query,
 | 
			
		||||
                        vec![&bible],
 | 
			
		||||
                    ) {
 | 
			
		||||
                        println!("{}", f);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return Ok(());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -208,15 +216,15 @@ impl State {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn view(&self) -> Element<Message> {
 | 
			
		||||
        scrollable(row![
 | 
			
		||||
        scrollable(
 | 
			
		||||
            row![
 | 
			
		||||
                row((0..self.cols).map(|col_index| {
 | 
			
		||||
                    column![
 | 
			
		||||
                        // header
 | 
			
		||||
                        button("Delete Column")
 | 
			
		||||
                            .on_press_with(move || Message::DeleteColumn(col_index))
 | 
			
		||||
                            .width(Length::Fill)
 | 
			
		||||
                        .style(button::danger)
 | 
			
		||||
                        ,
 | 
			
		||||
                            .style(button::danger),
 | 
			
		||||
                        combo_box(
 | 
			
		||||
                            &self.files,
 | 
			
		||||
                            "Select Bible",
 | 
			
		||||
@@ -235,12 +243,10 @@ impl State {
 | 
			
		||||
                        row![
 | 
			
		||||
                            button("Clear All")
 | 
			
		||||
                                .on_press_with(move || Message::Clear(col_index))
 | 
			
		||||
                            .style(button::secondary)
 | 
			
		||||
                            ,
 | 
			
		||||
                                .style(button::secondary),
 | 
			
		||||
                            button("Copy Scripture")
 | 
			
		||||
                                .on_press_with(move || Message::CopyText(col_index))
 | 
			
		||||
                            .style(button::primary)
 | 
			
		||||
                            ,
 | 
			
		||||
                                .style(button::primary),
 | 
			
		||||
                        ]
 | 
			
		||||
                        .spacing(5),
 | 
			
		||||
                        row![
 | 
			
		||||
@@ -263,7 +269,8 @@ impl State {
 | 
			
		||||
                            )
 | 
			
		||||
                            .spacing(5),
 | 
			
		||||
                            // Body
 | 
			
		||||
                        scrollable(if let Some(body) = &self.states[col_index].scripture_body {
 | 
			
		||||
                            scrollable(
 | 
			
		||||
                                if let Some(body) = &self.states[col_index].scripture_body {
 | 
			
		||||
                                    column(body.split("\n").enumerate().map(|(i, msg)| {
 | 
			
		||||
                                        let msg = parse(msg);
 | 
			
		||||
                                        if i & 1 == 0 {
 | 
			
		||||
@@ -278,7 +285,8 @@ impl State {
 | 
			
		||||
                                            .iter()
 | 
			
		||||
                                            .map(|_| text(String::new()).into()),
 | 
			
		||||
                                    )
 | 
			
		||||
                        })
 | 
			
		||||
                                }
 | 
			
		||||
                            )
 | 
			
		||||
                            .spacing(5)
 | 
			
		||||
                        ],
 | 
			
		||||
                    ]
 | 
			
		||||
@@ -294,7 +302,7 @@ impl State {
 | 
			
		||||
            // 5 pixles css-like padding
 | 
			
		||||
            .padding([5, 5])
 | 
			
		||||
            // space elements inside this 5 pixels apart
 | 
			
		||||
        .spacing(5)
 | 
			
		||||
            .spacing(5),
 | 
			
		||||
        )
 | 
			
		||||
        .direction(Direction::Horizontal(Scrollbar::new()))
 | 
			
		||||
        .into()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user