mirror of
https://github.com/zellij-org/zellij.git
synced 2024-12-18 06:32:09 +03:00
wip: remove the commands that are called only on the client
This commit is contained in:
parent
daddac65aa
commit
70d8be0741
@ -314,18 +314,9 @@ pub enum OsContext {
|
|||||||
impl From<&OsApiInstruction> for OsContext {
|
impl From<&OsApiInstruction> for OsContext {
|
||||||
fn from(os_instruction: &OsApiInstruction) -> Self {
|
fn from(os_instruction: &OsApiInstruction) -> Self {
|
||||||
match *os_instruction {
|
match *os_instruction {
|
||||||
OsApiInstruction::SpawnTerminal(_) => OsContext::SpawnTerminal,
|
|
||||||
OsApiInstruction::GetTerminalSizeUsingFd(_) => OsContext::GetTerminalSizeUsingFd,
|
|
||||||
OsApiInstruction::SetTerminalSizeUsingFd(_, _, _) => OsContext::SetTerminalSizeUsingFd,
|
OsApiInstruction::SetTerminalSizeUsingFd(_, _, _) => OsContext::SetTerminalSizeUsingFd,
|
||||||
OsApiInstruction::SetRawMode(_) => OsContext::SetRawMode,
|
|
||||||
OsApiInstruction::UnsetRawMode(_) => OsContext::UnsetRawMode,
|
|
||||||
OsApiInstruction::ReadFromTtyStdout(_, _) => OsContext::ReadFromTtyStdout,
|
|
||||||
OsApiInstruction::WriteToTtyStdin(_, _) => OsContext::WriteToTtyStdin,
|
OsApiInstruction::WriteToTtyStdin(_, _) => OsContext::WriteToTtyStdin,
|
||||||
OsApiInstruction::TcDrain(_) => OsContext::TcDrain,
|
OsApiInstruction::TcDrain(_) => OsContext::TcDrain,
|
||||||
OsApiInstruction::Kill(_) => OsContext::Kill,
|
|
||||||
OsApiInstruction::ReadFromStdin => OsContext::ReadFromStdin,
|
|
||||||
OsApiInstruction::GetStdoutWriter => OsContext::GetStdoutWriter,
|
|
||||||
OsApiInstruction::BoxClone => OsContext::BoxClone
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,18 +271,9 @@ impl OsApi for OsInputOutput {
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
pub enum OsApiInstruction {
|
pub enum OsApiInstruction {
|
||||||
GetTerminalSizeUsingFd(RawFd),
|
|
||||||
SetTerminalSizeUsingFd(RawFd, u16, u16),
|
SetTerminalSizeUsingFd(RawFd, u16, u16),
|
||||||
SetRawMode(RawFd),
|
|
||||||
UnsetRawMode(RawFd),
|
|
||||||
SpawnTerminal(Option<PathBuf>),
|
|
||||||
ReadFromTtyStdout(RawFd, Vec<u8>),
|
|
||||||
WriteToTtyStdin(RawFd, Vec<u8>),
|
WriteToTtyStdin(RawFd, Vec<u8>),
|
||||||
TcDrain(RawFd),
|
TcDrain(RawFd),
|
||||||
Kill(RawFd),
|
|
||||||
ReadFromStdin,
|
|
||||||
GetStdoutWriter,
|
|
||||||
BoxClone
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clone for Box<dyn OsApi> {
|
impl Clone for Box<dyn OsApi> {
|
||||||
|
@ -131,25 +131,9 @@ pub fn start_server(os_input: Box<dyn OsApi>, opts: CliArgs) -> (thread::JoinHan
|
|||||||
.expect("failed to receive an event on the channel");
|
.expect("failed to receive an event on the channel");
|
||||||
err_ctx.add_call(ContextType::Os(OsContext::from(&event)));
|
err_ctx.add_call(ContextType::Os(OsContext::from(&event)));
|
||||||
match event {
|
match event {
|
||||||
OsApiInstruction::SpawnTerminal(file_to_open) => {
|
|
||||||
os_input.spawn_terminal(file_to_open);
|
|
||||||
}
|
|
||||||
OsApiInstruction::GetTerminalSizeUsingFd(fd) => {
|
|
||||||
os_input.get_terminal_size_using_fd(fd);
|
|
||||||
}
|
|
||||||
OsApiInstruction::SetTerminalSizeUsingFd(fd, cols, rows) => {
|
OsApiInstruction::SetTerminalSizeUsingFd(fd, cols, rows) => {
|
||||||
os_input.set_terminal_size_using_fd(fd, cols, rows);
|
os_input.set_terminal_size_using_fd(fd, cols, rows);
|
||||||
}
|
}
|
||||||
OsApiInstruction::SetRawMode(fd) => {
|
|
||||||
os_input.set_raw_mode(fd);
|
|
||||||
}
|
|
||||||
OsApiInstruction::UnsetRawMode(fd) => {
|
|
||||||
os_input.unset_raw_mode(fd);
|
|
||||||
}
|
|
||||||
OsApiInstruction::ReadFromTtyStdout(fd, mut buf) => {
|
|
||||||
let slice = buf.as_mut_slice();
|
|
||||||
os_input.read_from_tty_stdout(fd, slice).unwrap();
|
|
||||||
}
|
|
||||||
OsApiInstruction::WriteToTtyStdin(fd, mut buf) => {
|
OsApiInstruction::WriteToTtyStdin(fd, mut buf) => {
|
||||||
let slice = buf.as_mut_slice();
|
let slice = buf.as_mut_slice();
|
||||||
os_input.write_to_tty_stdin(fd, slice).unwrap();
|
os_input.write_to_tty_stdin(fd, slice).unwrap();
|
||||||
@ -157,18 +141,6 @@ pub fn start_server(os_input: Box<dyn OsApi>, opts: CliArgs) -> (thread::JoinHan
|
|||||||
OsApiInstruction::TcDrain(fd) => {
|
OsApiInstruction::TcDrain(fd) => {
|
||||||
os_input.tcdrain(fd).unwrap();
|
os_input.tcdrain(fd).unwrap();
|
||||||
}
|
}
|
||||||
OsApiInstruction::Kill(pid) => {
|
|
||||||
os_input.kill(pid).unwrap();
|
|
||||||
}
|
|
||||||
OsApiInstruction::ReadFromStdin => {
|
|
||||||
os_input.read_from_stdin();
|
|
||||||
}
|
|
||||||
OsApiInstruction::GetStdoutWriter => {
|
|
||||||
os_input.get_stdout_writer();
|
|
||||||
}
|
|
||||||
OsApiInstruction::BoxClone => {
|
|
||||||
os_input.box_clone();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user