Cleanup
This commit is contained in:
parent
5b47c44e2d
commit
5a6b42472a
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -14,6 +14,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ansi4tui"
|
name = "ansi4tui"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
source = "git+https://github.com/austenadler/ansi4tui#8236eef9296fa41350af03ec09937f81f09a32b5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"termwiz",
|
"termwiz",
|
||||||
"tui",
|
"tui",
|
||||||
|
11
Cargo.toml
11
Cargo.toml
@ -9,7 +9,7 @@ edition = "2021"
|
|||||||
tui = "0.19"
|
tui = "0.19"
|
||||||
crossterm = { version = "0.25", features = ["bracketed-paste"] }
|
crossterm = { version = "0.25", features = ["bracketed-paste"] }
|
||||||
atty = "0.2.14"
|
atty = "0.2.14"
|
||||||
ansi4tui = {path = "./ansi4tui/"}
|
ansi4tui = {git = "https://github.com/austenadler/ansi4tui"}
|
||||||
anyhow = "1.0.66"
|
anyhow = "1.0.66"
|
||||||
shellwords = "1.1.0"
|
shellwords = "1.1.0"
|
||||||
crossbeam = "0.8.2"
|
crossbeam = "0.8.2"
|
||||||
@ -17,3 +17,12 @@ parking_lot = "0.12.1"
|
|||||||
tracing = { version = "0.1.37", features = ["release_max_level_off"] }
|
tracing = { version = "0.1.37", features = ["release_max_level_off"] }
|
||||||
tracing-subscriber = "0.3.16"
|
tracing-subscriber = "0.3.16"
|
||||||
ropey = "1.5.0"
|
ropey = "1.5.0"
|
||||||
|
|
||||||
|
[package.metadata.deb]
|
||||||
|
maintainer = "Austen Adler <agadler@austenadler.com>"
|
||||||
|
copyright = "2022, Austen Adler <agadler@austenadler.com>"
|
||||||
|
extended-description = """\
|
||||||
|
A TUI for interactively writing pipelines."""
|
||||||
|
depends = "$auto"
|
||||||
|
section = "utility"
|
||||||
|
priority = "optional"
|
||||||
|
@ -34,6 +34,8 @@ pub fn command_event_loop(
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
loop {
|
loop {
|
||||||
match command_request_receiver.recv() {
|
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) => {
|
Ok(command_request) => {
|
||||||
event_sender.send(EventMessage::CommandCompleted(
|
event_sender.send(EventMessage::CommandCompleted(
|
||||||
match run_inner(&command_request) {
|
match run_inner(&command_request) {
|
||||||
@ -42,7 +44,6 @@ pub fn command_event_loop(
|
|||||||
if !c.status_success && c.stdout.len_bytes() == 0 {
|
if !c.status_success && c.stdout.len_bytes() == 0 {
|
||||||
CommandCompleted::Failure(c.stderr)
|
CommandCompleted::Failure(c.stderr)
|
||||||
} else {
|
} else {
|
||||||
// CommandCompleted::Success((c, FormattedCommandResult::from(&c)))
|
|
||||||
CommandCompleted::Success(c)
|
CommandCompleted::Success(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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<()> {
|
pub fn run_command(&self) -> Result<()> {
|
||||||
self.command_request_tx
|
self.command_request_tx
|
||||||
.send((self.command_options.clone(), self.text_orig.clone()))?;
|
.send((self.command_options.clone(), self.text_orig.clone()))?;
|
||||||
|
Loading…
Reference in New Issue
Block a user