From dfd5ebfa25d799399de0d15cb38ba47f5069647b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 26 Feb 2022 18:08:40 -0500 Subject: reduce typing --- src/shell/history/mod.rs | 6 +++--- src/shell/history/pty.rs | 4 ++-- src/shell/mod.rs | 6 +++--- src/shell/readline.rs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/shell') diff --git a/src/shell/history/mod.rs b/src/shell/history/mod.rs index 6d38891..e7202be 100644 --- a/src/shell/history/mod.rs +++ b/src/shell/history/mod.rs @@ -26,7 +26,7 @@ impl History { focus: Option, scrolling: bool, offset: time::UtcOffset, - ) -> anyhow::Result<()> { + ) -> Result<()> { let mut used_lines = repl_lines; let mut cursor = None; for (idx, mut entry) in @@ -87,7 +87,7 @@ impl History { cmdline: &str, env: &Env, event_w: crate::shell::event::Writer, - ) -> anyhow::Result { + ) -> Result { let (input_w, input_r) = tokio::sync::mpsc::unbounded_channel(); let (resize_w, resize_r) = tokio::sync::mpsc::unbounded_channel(); @@ -279,7 +279,7 @@ async fn spawn_commands( pty: &pty::Pty, env: &mut Env, event_w: crate::shell::event::Writer, -) -> anyhow::Result { +) -> Result { enum Res { Read(crate::runner::Event), Exit(std::io::Result), diff --git a/src/shell/history/pty.rs b/src/shell/history/pty.rs index 58f872c..e96da41 100644 --- a/src/shell/history/pty.rs +++ b/src/shell/history/pty.rs @@ -12,7 +12,7 @@ impl Pty { input_r: tokio::sync::mpsc::UnboundedReceiver>, resize_r: tokio::sync::mpsc::UnboundedReceiver<(u16, u16)>, event_w: crate::shell::event::Writer, - ) -> anyhow::Result { + ) -> Result { let (close_w, close_r) = tokio::sync::mpsc::unbounded_channel(); let pty = pty_process::Pty::new()?; @@ -35,7 +35,7 @@ impl Pty { pub fn spawn( &self, mut cmd: pty_process::Command, - ) -> anyhow::Result { + ) -> Result { Ok(cmd.spawn(&*self.pts)?) } diff --git a/src/shell/mod.rs b/src/shell/mod.rs index c187272..88eb63e 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -9,7 +9,7 @@ mod history; mod prelude; mod readline; -pub async fn main() -> anyhow::Result { +pub async fn main() -> Result { let mut input = textmode::blocking::Input::new()?; let mut output = textmode::Output::new().await?; @@ -205,7 +205,7 @@ pub struct Shell { } impl Shell { - pub fn new(offset: time::UtcOffset) -> anyhow::Result { + pub fn new(offset: time::UtcOffset) -> Result { let mut env = Env::new()?; env.set_var("SHELL", std::env::current_exe()?); env.set_var("TERM", "screen"); @@ -225,7 +225,7 @@ impl Shell { pub async fn render( &self, out: &mut impl textmode::Textmode, - ) -> anyhow::Result<()> { + ) -> Result<()> { out.clear(); out.write(&vt100::Parser::default().screen().input_mode_formatted()); match self.scene { diff --git a/src/shell/readline.rs b/src/shell/readline.rs index f0fb950..463a7f0 100644 --- a/src/shell/readline.rs +++ b/src/shell/readline.rs @@ -26,7 +26,7 @@ impl Readline { git: Option<&super::git::Info>, focus: bool, offset: time::UtcOffset, - ) -> anyhow::Result<()> { + ) -> Result<()> { let pwd = env.pwd(); let user = crate::info::user()?; let hostname = crate::info::hostname()?; -- cgit v1.2.3-54-g00ecf