I don't know the whole architecture you're going to need, but here's what I would try:
(note: I'm relatively new in both Rust and TUI in Rust)
Output
The command output is often printed via stdout. If you use Rust's Command then you probably do (this is pseudo code):
let mut cmd = std::process::Command::new("....");
cmd.status().expect("Something went wrong");
To capture the stdout (and stream from it) you can see this answer here on SO, which will show you how to use Piped()
so you can use a BufReader
to read the output. From there you will need to pass this to your UI.
If you're using TUI-RS, you would probably benefit from looking at various examples on their repo where they set up the basic arch to communicate from a thread back to the UI using a mpsc (multi-producer, single consumer) channel.
When learning about this (I ultimately went with Cursive as it was better suited for my "kind of app" at the time), I found this github repository of a Rust Command-Line example using TUI of great help to put the pieces together. I also learned a lot from this simplified version of the Spotify TUI App's architecture.
You're going to have to send the output of your terminal (stdout/err) via the channel to the receiver end who has means to talk to the UI (likely by delivering events) which will ultimately "print" the commands in your "widgets".