From 5a6b42472a17ac0df8c7d0b80fafbfe42f4da5cb Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Thu, 22 Dec 2022 14:30:12 -0500 Subject: [PATCH] Cleanup --- Cargo.lock | 1 + Cargo.toml | 11 ++++++++++- src/command.rs | 3 ++- src/main.rs | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 880805d..7619a82 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,6 +14,7 @@ dependencies = [ [[package]] name = "ansi4tui" version = "0.2.1" +source = "git+https://github.com/austenadler/ansi4tui#8236eef9296fa41350af03ec09937f81f09a32b5" dependencies = [ "termwiz", "tui", diff --git a/Cargo.toml b/Cargo.toml index e0c30f0..5d2cd14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" tui = "0.19" crossterm = { version = "0.25", features = ["bracketed-paste"] } atty = "0.2.14" -ansi4tui = {path = "./ansi4tui/"} +ansi4tui = {git = "https://github.com/austenadler/ansi4tui"} anyhow = "1.0.66" shellwords = "1.1.0" crossbeam = "0.8.2" @@ -17,3 +17,12 @@ parking_lot = "0.12.1" tracing = { version = "0.1.37", features = ["release_max_level_off"] } tracing-subscriber = "0.3.16" ropey = "1.5.0" + +[package.metadata.deb] +maintainer = "Austen Adler " +copyright = "2022, Austen Adler " +extended-description = """\ +A TUI for interactively writing pipelines.""" +depends = "$auto" +section = "utility" +priority = "optional" diff --git a/src/command.rs b/src/command.rs index d185977..63d4055 100644 --- a/src/command.rs +++ b/src/command.rs @@ -34,6 +34,8 @@ pub fn command_event_loop( ) -> Result<()> { loop { match command_request_receiver.recv() { + // TODO: Drain the command request channel so we only run the command once with the latest value + // Could use https://docs.rs/single_value_channel/latest/single_value_channel/ Ok(command_request) => { event_sender.send(EventMessage::CommandCompleted( match run_inner(&command_request) { @@ -42,7 +44,6 @@ pub fn command_event_loop( if !c.status_success && c.stdout.len_bytes() == 0 { CommandCompleted::Failure(c.stderr) } else { - // CommandCompleted::Success((c, FormattedCommandResult::from(&c))) CommandCompleted::Success(c) } } diff --git a/src/main.rs b/src/main.rs index 534a63c..f18e764 100644 --- a/src/main.rs +++ b/src/main.rs @@ -160,6 +160,11 @@ impl App { } } +/// Run a command by sending a command request to the inner channel +/// +/// # Errors +/// +/// When the channel closes and the send fails pub fn run_command(&self) -> Result<()> { self.command_request_tx .send((self.command_options.clone(), self.text_orig.clone()))?;