Use ipc_channel crate to communicate between cli and app
We still aren't handling CLI requests in the app, but this lays the foundation for bi-directional communication. Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
01eb2dce24
commit
75f0326e54
10 changed files with 134 additions and 52 deletions
21
crates/cli/src/cli.rs
Normal file
21
crates/cli/src/cli.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
pub use ipc_channel::ipc;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct IpcHandshake {
|
||||
pub requests: ipc::IpcSender<CliRequest>,
|
||||
pub responses: ipc::IpcReceiver<CliResponse>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum CliRequest {
|
||||
Open { paths: Vec<PathBuf>, wait: bool },
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum CliResponse {
|
||||
Stdout { message: String },
|
||||
Stderr { message: String },
|
||||
Exit { status: i32 },
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue