cli.rs

 1use collections::HashMap;
 2pub use ipc_channel::ipc;
 3use serde::{Deserialize, Serialize};
 4
 5#[derive(Serialize, Deserialize)]
 6pub struct IpcHandshake {
 7    pub requests: ipc::IpcSender<CliRequest>,
 8    pub responses: ipc::IpcReceiver<CliResponse>,
 9}
10
11#[derive(Debug, Serialize, Deserialize)]
12pub enum CliRequest {
13    Open {
14        paths: Vec<String>,
15        urls: Vec<String>,
16        diff_paths: Vec<[String; 2]>,
17        wsl: Option<String>,
18        wait: bool,
19        open_new_workspace: Option<bool>,
20        reuse: bool,
21        env: Option<HashMap<String, String>>,
22        user_data_dir: Option<String>,
23    },
24}
25
26#[derive(Debug, Serialize, Deserialize)]
27pub enum CliResponse {
28    Ping,
29    Stdout { message: String },
30    Stderr { message: String },
31    Exit { status: i32 },
32}
33
34/// When Zed started not as an *.app but as a binary (e.g. local development),
35/// there's a possibility to tell it to behave "regularly".
36pub const FORCE_CLI_MODE_ENV_VAR_NAME: &str = "ZED_FORCE_CLI_MODE";