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 diff_all: bool,
18 wsl: Option<String>,
19 wait: bool,
20 open_new_workspace: Option<bool>,
21 reuse: bool,
22 env: Option<HashMap<String, String>>,
23 user_data_dir: Option<String>,
24 },
25}
26
27#[derive(Debug, Serialize, Deserialize)]
28pub enum CliResponse {
29 Ping,
30 Stdout { message: String },
31 Stderr { message: String },
32 Exit { status: i32 },
33}
34
35/// When Zed started not as an *.app but as a binary (e.g. local development),
36/// there's a possibility to tell it to behave "regularly".
37pub const FORCE_CLI_MODE_ENV_VAR_NAME: &str = "ZED_FORCE_CLI_MODE";