GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat: add separate cli package
Lars Bergerc8816c04e0a4
diff --git a/Cargo.lock b/Cargo.lockindex a33d3f18..440ea137 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -198,6 +198,16 @@ version = "0.7.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"+[[package]]+name = "cli"+version = "0.0.0"+dependencies = [+ "anyhow",+ "ipc-client",+ "tokio",+ "wm",+]+[[package]]name = "colorchoice"version = "1.0.0"diff --git a/packages/cli/Cargo.toml b/packages/cli/Cargo.tomlnew file mode 100644index 00000000..9be0fbd5--- /dev/null+++ b/packages/cli/Cargo.toml@@ -0,0 +1,11 @@+[package]+name = "cli"+version = "0.0.0"+edition = "2021"++[dependencies]+ipc-client = { path = "../ipc-client" }+wm = { path = "../wm", artifact = "bin" }++anyhow = { workspace = true }+tokio = { workspace = true }diff --git a/packages/cli/src/main.rs b/packages/cli/src/main.rsnew file mode 100644index 00000000..ba5557e5--- /dev/null+++ b/packages/cli/src/main.rs@@ -0,0 +1,29 @@+#[derive(Parser, Debug)]+#[clap(author, version, about, long_about = None, arg_required_else_help = true)]+pub struct Cli {+ #[command(subcommand)]+ pub message: WmMessage,+}++#[tokio::main]+async fn main() {+ let cli = Cli::parse();++ match cli.message {+ WmMessage::Start { config_path } => {+ let wm_path = env::var_os("CARGO_BIN_FILE_WM")+ .context("Failed to resolve path to the WM process.")?;++ Command::new(wm_path)+ }+ _ => {+ let args = std::env::args_os();+ IpcClient::connect()+ .await+ .unwrap()+ .send_raw(args)+ .await+ .unwrap()+ }+ }+}diff --git a/packages/wm/src/main.rs b/packages/wm/src/main.rsindex e1034d08..395916e8 100644--- a/packages/wm/src/main.rs+++ b/packages/wm/src/main.rs@@ -98,7 +98,7 @@ async fn start_wm(config_path: Option<String>) -> Result<()> {fn start_watcher_process() -> Result<Command> {let watcher_path = env::var_os("CARGO_BIN_FILE_WATCHER")- .context("Failed to resolve path to watcher process.")?;+ .context("Failed to resolve path to the watcher process.")?;Ok(Command::new(watcher_path))}