diff options
author | Sam Tay <sam.chong.tay@gmail.com> | 2020-06-11 00:50:41 -0700 |
---|---|---|
committer | Sam Tay <sam.chong.tay@gmail.com> | 2020-06-11 00:50:41 -0700 |
commit | 37ab4c85f9d8bf1e113c4b1b419c0d17ec72b84e (patch) | |
tree | 694e9e3ad3303f8213432d6fd44a6455ba982a21 /src/main.rs | |
parent | 7ac11eee2b38522f22fa44227ffb6411b4f758e4 (diff) |
...Use cursive instead
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/src/main.rs b/src/main.rs index f66e192..e099d21 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,3 @@ -#![allow(dead_code, unused_imports, unused_mut, unused_variables)] mod cli; mod config; mod error; @@ -65,40 +64,13 @@ fn main() { } if let Some(q) = opts.query { - //let se = StackExchange::new(config); - // TODO async - //let qs = se.search(&q)?; - //let ans = que.first().ok_or(Error::NoResults)?.answers.first().expect( - //"StackExchange returned a question with no answers; \ - //this shouldn't be possible!", - //); - // TODO eventually do this in the right place, e.g. abstract out md parser, write benches, & do within threads - // TODO do the below for --lucky with option to continue - //let md = ans.body.replace("<kbd>", "**[").replace("</kbd>", "]**"); + let se = StackExchange::new(config); + //TODO async + let qs = se.search(&q)?; + //TODO do the print_text below for --lucky with option to continue //skin.print_text(&md); - use crate::stackexchange::{Answer, Question}; - tui::run(vec![Question { - id: 42, - score: 323, - title: "How do I exit Vim?".to_string(), - body: "yo this be my problem dawg but don't say **do** `this`".to_string(), - answers: vec![ - Answer { - id: 422, - score: -4, - body: "# bad\nthis is my bad answer".to_string(), - is_accepted: false, - }, - Answer { - id: 423, - score: 23, - body: "this is a *good* answer tho".to_string(), - is_accepted: true, - }, - ], - }])?; + tui::run(qs)?; } - Ok(()) })() .or_else(|e: Error| { |