Add --add/--new to control CLI behaviour (#9202)

When neither is specified, if you open a directory you get a new
workspace, otherwise files are added to your existing workspace.

With --new files are always opened in a new workspace
With --add directories are always added to an existing workspace

Fixes #9076
Fixes #4861
Fixes #5370

Release Notes:

- Added `-n/--new` and `-a/--add` to the zed CLI. When neither is
specified, if you open a directory you get a new workspace, otherwise
files are added to your existing workspace. With `--new` files are
always opened in a new workspace, with `--add` directories are always
added to an existing workspace.
([#9076](https://github.com/zed-industries/zed/issues/9096),
[#4861](https://github.com/zed-industries/zed/issues/4861),
[#5370](https://github.com/zed-industries/zed/issues/5370)).
This commit is contained in:
Conrad Irwin 2024-03-12 14:27:58 -06:00 committed by GitHub
parent 89c67fb1ab
commit 05dfe96f0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 369 additions and 103 deletions

View file

@ -9,12 +9,11 @@ pub struct IpcHandshake {
#[derive(Debug, Serialize, Deserialize)]
pub enum CliRequest {
// The filed is named `path` for compatibility, but now CLI can request
// opening a path at a certain row and/or column: `some/path:123` and `some/path:123:456`.
//
// Since Zed CLI has to be installed separately, there can be situations when old CLI is
// querying new Zed editors, support both formats by using `String` here and parsing it on Zed side later.
Open { paths: Vec<String>, wait: bool },
Open {
paths: Vec<String>,
wait: bool,
open_new_workspace: Option<bool>,
},
}
#[derive(Debug, Serialize, Deserialize)]