diff options
author | NerdyPepper <[email protected]> | 2018-06-21 12:46:09 +0100 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2018-06-21 12:46:09 +0100 |
commit | aa9d82749ae45bc7c5310e1c2c901551aab65c83 (patch) | |
tree | dce54274e1cd9cd8f138cb825a867118ea30977a | |
parent | 81379203747a64ab9d7954c06ffb3b565980299d (diff) |
Resultify all functs
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index bc1188d..9a27b0e 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -9,6 +9,7 @@ use cursive::traits::*; | |||
9 | use cursive::views::{TextView, Dialog, EditView, SelectView}; | 9 | use cursive::views::{TextView, Dialog, EditView, SelectView}; |
10 | 10 | ||
11 | pub mod content; | 11 | pub mod content; |
12 | use content::*; | ||
12 | 13 | ||
13 | fn main() { | 14 | fn main() { |
14 | // Initial setup | 15 | // Initial setup |
@@ -25,8 +26,12 @@ fn search(s: &mut Cursive){ | |||
25 | 26 | ||
26 | fn go(s: &mut Cursive, search: &str) { | 27 | fn go(s: &mut Cursive, search: &str) { |
27 | s.pop_layer(); | 28 | s.pop_layer(); |
28 | let results = content::get_search_results(search); | 29 | let mut result; |
29 | s.add_layer(SelectView::new().with_all_str(results)); | 30 | match get_search_results(search) { |
31 | Ok(x) => result = x, | ||
32 | Err(e) => pop_error(s,handler(e)), | ||
33 | }; | ||
34 | let choose_result = SelectView::new().with_all_str(result); | ||
30 | } | 35 | } |
31 | 36 | ||
32 | s.add_layer(Dialog::around(EditView::new() | 37 | s.add_layer(Dialog::around(EditView::new() |