* chore(config): default kdl keybindings config * tests * work * refactor(config): move stuff around * work * tab merge layout * work * work * layouts working * work * layout tests * work * work * feat(parsing): kdl layouts without config * refactor(kdl): move stuff around * work * tests(layout): add cases and fix bugs * work * fix(kdl): various bugs * chore(layouts): move all layouts to kdl * feat(kdl): shared keybidns * fix(layout): do not count fixed panes toward percentile * fix(keybinds): missing keybinds and actions * fix(config): adjust default tips * refactor(config): move stuff around * fix(tests): make e2e tests pass * fix(kdl): add verbose parsing errors * fix(kdl): focused tab * fix(layout): corret default_tab_template behavior * style(code): fix compile warnings * feat(cli): send actions through the cli * fix(cli): exit only when action is done * fix(cli): open embedded pane from floating pane * fix(cli): send actions to other sessions * feat(cli): command alias * feat(converter): convert old config * feat(converter): convert old layout and theme files * feat(kdl): pretty errors * feat(client): convert old YAML files on startup * fix: various bugs and styling issues * fix: e2e tests * fix(screen): propagate errors after merge * style(clippy): lower clippy level * fix(tests): own session_name variable * style(fmt): rustfmt * fix(cli): various action fixes * style(fmt): rustfmt * fix(themes): loading of theme files * style(fmt): rustfmt * fix(tests): theme fixtures * fix(layouts): better errors on unknown nodes * fix(kdl): clarify valid node terminator error * fix(e2e): adjust close tab test * fix(e2e): adjust close tab test again * style(code): cleanup some comments
34 lines
1.2 KiB
Rust
34 lines
1.2 KiB
Rust
//! The `[cli_client]` is used to attach to a running server session
|
|
//! and dispatch actions, that are specified through the command line.
|
|
use std::process;
|
|
use std::{fs, path::PathBuf};
|
|
|
|
use crate::os_input_output::ClientOsApi;
|
|
use zellij_utils::{
|
|
input::actions::Action,
|
|
ipc::{ClientToServerMsg, ServerToClientMsg},
|
|
};
|
|
|
|
pub fn start_cli_client(os_input: Box<dyn ClientOsApi>, session_name: &str, actions: Vec<Action>) {
|
|
let zellij_ipc_pipe: PathBuf = {
|
|
let mut sock_dir = zellij_utils::consts::ZELLIJ_SOCK_DIR.clone();
|
|
fs::create_dir_all(&sock_dir).unwrap();
|
|
zellij_utils::shared::set_permissions(&sock_dir, 0o700).unwrap();
|
|
sock_dir.push(session_name);
|
|
sock_dir
|
|
};
|
|
os_input.connect_to_server(&*zellij_ipc_pipe);
|
|
for action in actions {
|
|
let msg = ClientToServerMsg::Action(action, None);
|
|
os_input.send_to_server(msg);
|
|
}
|
|
loop {
|
|
match os_input.recv_from_server() {
|
|
Some((ServerToClientMsg::UnblockInputThread, _)) => {
|
|
os_input.send_to_server(ClientToServerMsg::ClientExited);
|
|
process::exit(0);
|
|
},
|
|
_ => {},
|
|
}
|
|
}
|
|
}
|