Attempt to open rows and columns from CLI input

This commit is contained in:
Kirill Bulatov 2023-05-12 18:13:28 +03:00
parent d719352152
commit 628558aa39
5 changed files with 91 additions and 32 deletions

View file

@ -1,6 +1,7 @@
pub use ipc_channel::ipc;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use util::paths::PathLikeWithPosition;
#[derive(Serialize, Deserialize)]
pub struct IpcHandshake {
@ -10,7 +11,11 @@ pub struct IpcHandshake {
#[derive(Debug, Serialize, Deserialize)]
pub enum CliRequest {
Open { paths: Vec<PathBuf>, wait: bool },
Open {
// TODO kb old cli won't be able to communicate to new Zed with this change
paths: Vec<PathLikeWithPosition<PathBuf>>,
wait: bool,
},
}
#[derive(Debug, Serialize, Deserialize)]

View file

@ -21,7 +21,7 @@ use util::paths::PathLikeWithPosition;
#[derive(Parser)]
#[clap(name = "zed", global_setting(clap::AppSettings::NoAutoVersion))]
struct Args {
/// Wait for all of the given paths to be closed before exiting.
/// Wait for all of the given paths to be opened/closed before exiting.
#[clap(short, long)]
wait: bool,
/// A sequence of space-separated paths that you want to open.
@ -78,12 +78,13 @@ fn main() -> Result<()> {
paths: args
.paths_with_position
.into_iter()
// TODO kb continue sendint path with the position further
.map(|path_with_position| path_with_position.path_like)
.map(|path| {
fs::canonicalize(&path).with_context(|| format!("path {path:?} canonicalization"))
.map(|path_with_position| {
path_with_position.convert_path(|path| {
fs::canonicalize(&path)
.with_context(|| format!("path {path:?} canonicalization"))
})
})
.collect::<Result<Vec<PathBuf>>>()?,
.collect::<Result<_>>()?,
wait: args.wait,
})?;