From 95c394cbaf935e8e9bc195117afed733f3ea908c Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sat, 18 Feb 2023 16:23:38 -0500 Subject: [PATCH] Print command after output --- src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index d636886..8392093 100644 --- a/src/main.rs +++ b/src/main.rs @@ -202,7 +202,7 @@ fn main() -> Result<()> { let backend = CrosstermBackend::new(stdout); let mut terminal = Terminal::new(backend)?; - let res = run_app(&mut terminal, &mut app); + let resulting_commandline = run_app(&mut terminal, &mut app); // Restore terminal disable_raw_mode()?; @@ -214,13 +214,13 @@ fn main() -> Result<()> { )?; terminal.show_cursor()?; - let res = res?; + let resulting_commandline = resulting_commandline?; - if let Some(res) = res { - std::io::stderr().write_all(res.as_bytes())?; - std::io::stderr().write_all(b"\n")?; + if let Some(resulting_commandline) = resulting_commandline { // TODO: I do not want to collect the whole thing into a vec app.command_options.read().command_result.as_ref().map(|r| std::io::stdout().write_all(&r.stdout.bytes().collect::>())).transpose()?; + std::io::stderr().write_all(b"\n")?; + std::io::stderr().write_all(resulting_commandline.as_bytes())?; } Ok(())