cli.rs

 1pub use ipc_channel::ipc;
 2use serde::{Deserialize, Serialize};
 3use std::path::PathBuf;
 4use util::paths::PathLikeWithPosition;
 5
 6#[derive(Serialize, Deserialize)]
 7pub struct IpcHandshake {
 8    pub requests: ipc::IpcSender<CliRequest>,
 9    pub responses: ipc::IpcReceiver<CliResponse>,
10}
11
12#[derive(Debug, Serialize, Deserialize)]
13pub enum CliRequest {
14    Open {
15        // TODO kb old cli won't be able to communicate to new Zed with this change
16        paths: Vec<PathLikeWithPosition<PathBuf>>,
17        wait: bool,
18    },
19}
20
21#[derive(Debug, Serialize, Deserialize)]
22pub enum CliResponse {
23    Ping,
24    Stdout { message: String },
25    Stderr { message: String },
26    Exit { status: i32 },
27}
28
29/// When Zed started not as an *.app but as a binary (e.g. local development),
30/// there's a possibility to tell it to behave "regularly".
31pub const FORCE_CLI_MODE_ENV_VAR_NAME: &str = "ZED_FORCE_CLI_MODE";