* extend display char in tab * Add action to list all tab names * print tab names and remove logs * change msg name, and handle Log in normal client * fix log * resolve code conflict * change var name * add snapshot test * fix failed test case * restore snapshot * Revert "restore snapshot" This reverts commit b97a9512ab106615a1a1e5882392a03a17cdf1a3. * restore snapshot * revert snapshot * fix(layout): various parser and ui fixes (#2191) * fix(layout): error on nodes outside layout node * fix(layout): move stacked property to pane * fix(layout): various stack exceptions * fix(ui): non-flexible stacked pane titles now take up their full length * fix(ui): stack titles with no-pane-frames take up their proper length * style(fmt): rustfmt * docs(changelog): layout fixes * fix(messaging): cache hold pane messages by their tab_id if the tab is not ready (#2196) * fix(messaging): cache hold pane messages by their tab_id if the tab is not ready * style(fmt): rustfmt * docs(changelog): open panes fix * fix(layout): tab focus (#2197) * fix(layout): tab focus * style(fmt): rustfmt * docs(changel0g): tab focus fix * fix(cli): new-tab now also looks in layout_dir for layouts (#2198) * fix(cli): the new-tab action now also searches for layouts in the layout dir * style(fmt): rustfmt * fix(tests): add missing parameter to cli action * docs(changelog): new-tab cli layout folder fix * fix(kdl): new-tab keybind looks in layout_dir for layouts (#2200) * fix(themes): missing tokyo-night-dark theme * fix(kdl): new-tab keybind also looks in layout_dir for layouts * docs(changelog): new-tab keybind layout folder fix * fix(cli): edit cwd (#2201) * fix(cli): properly set cwd for edit panes * fix(layouts): properly set cwd for edit panes * style(fmt): rustfmt * docs(changelog0 * fix(layouts): do not relayout twice on auto_layout (#2202) * fix(layouts): do not relayout twice on auto_layout * style(fmt): rustfmt * fix(new-tab): get config parameters from config file (#2203) * fix(cli): take default shell from config if it exists when opening new tab * fix(cli): take layout dir from config when opening new tab if it exists * style(fmt): rustfmt * docs(changelog): new-tab config parameters * fix(grid): only use background pending styling when deleting characters (#2204) * docs(changelog): neovim underline fix * feat(layouts): exact panes constraint (#2206) * style(fmt): remove warnings * fix(swap-layouts): introduce exact panes constraint * fix(swap-layouts): improve floating pane swap layout ux * style(fmt): rustfmt * docs(changelog): exact panes constraint * fix(pty): report no-cwd for empty path returned from sysinfo (#2213) * fix(sixel): report pixel size in winsize change ioctl (#2212) * fix(sixel): report pixel size in winsize change ioctl * style(fmt): rustfmt * docs(changelog): various fixes * style(code): naming * test(log): adjust query tab names test to look at the log message * style(fmt): rustfmt --------- Co-authored-by: Aram Drevekenin <aram@poor.dev> Co-authored-by: Jae-Heon Ji <32578710+jaeheonji@users.noreply.github.com>
38 lines
1.3 KiB
Rust
38 lines
1.3 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);
|
|
},
|
|
Some((ServerToClientMsg::Log(log_lines), _)) => {
|
|
log_lines.iter().for_each(|line| println!("{line}"));
|
|
process::exit(0);
|
|
},
|
|
_ => {},
|
|
}
|
|
}
|
|
}
|