aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-07-12 00:42:47 -0400
committerJesse Luehrs <doy@tozt.net>2019-07-12 00:42:47 -0400
commit9db947a3f01a3138a4d86eae04cf1aa5fcca6010 (patch)
treedbc6becdef4c7cb7da00feae6cf64853ff7a0c44
parentdddc1a724a2f13676688e45315f3f6360d1e6113 (diff)
downloadnbsh-old-9db947a3f01a3138a4d86eae04cf1aa5fcca6010.tar.gz
nbsh-old-9db947a3f01a3138a4d86eae04cf1aa5fcca6010.zip
simplify
-rw-r--r--src/tui.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/tui.rs b/src/tui.rs
index c6446b6..1bdc49e 100644
--- a/src/tui.rs
+++ b/src/tui.rs
@@ -24,12 +24,10 @@ pub enum Error {
pub type Result<T> = std::result::Result<T, Error>;
pub fn tui() {
- match Tui::new() {
- Ok(state) => tokio::run(state),
- Err(e) => eprintln!("failed to create state: {}", e),
- }
+ tokio::run(Tui::new());
}
+#[derive(Default)]
pub struct Tui {
idx: usize,
readline: Option<crate::readline::Readline>,
@@ -37,12 +35,8 @@ pub struct Tui {
}
impl Tui {
- pub fn new() -> Result<Self> {
- Ok(Self {
- idx: 0,
- readline: Some(Self::read()?),
- commands: std::collections::HashMap::new(),
- })
+ pub fn new() -> Self {
+ Self::default()
}
fn read() -> Result<crate::readline::Readline> {