diff options
-rw-r--r-- | Cargo.lock | 36 | ||||
-rw-r--r-- | Cargo.toml | 10 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/tests/fakes.rs | 9 | ||||
-rw-r--r-- | src/tests/utils.rs | 2 | ||||
-rw-r--r-- | zellij-client/Cargo.toml | 8 | ||||
-rw-r--r-- | zellij-client/src/input_handler.rs | 2 | ||||
-rw-r--r-- | zellij-client/src/os_input_output.rs | 12 | ||||
-rw-r--r-- | zellij-server/Cargo.toml | 21 | ||||
-rw-r--r-- | zellij-server/src/lib.rs | 7 | ||||
-rw-r--r-- | zellij-server/src/os_input_output.rs | 23 | ||||
-rw-r--r-- | zellij-server/src/panes/grid.rs | 3 | ||||
-rw-r--r-- | zellij-server/src/panes/terminal_character.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/panes/terminal_pane.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/panes/unit/grid_tests.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/pty.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/route.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/screen.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/tab.rs | 3 | ||||
-rw-r--r-- | zellij-server/src/ui/boundaries.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/ui/layout.rs | 5 | ||||
-rw-r--r-- | zellij-server/src/wasm_vm.rs | 2 | ||||
-rw-r--r-- | zellij-utils/Cargo.toml | 19 | ||||
-rw-r--r-- | zellij-utils/src/lib.rs | 12 |
24 files changed, 97 insertions, 93 deletions
diff --git a/Cargo.lock b/Cargo.lock index 31c5e7093..48aa2bf2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -453,9 +453,9 @@ dependencies = [ [[package]] name = "crossterm" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e86d73f2a0b407b5768d10a8c720cf5d2df49a9efc10ca09176d201ead4b7fb" +checksum = "7c36c10130df424b2f3552fcc2ddcd9b28a27b1e54b358b45874f88d1ca6888c" dependencies = [ "bitflags", "crossterm_winapi", @@ -469,9 +469,9 @@ dependencies = [ [[package]] name = "crossterm_winapi" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2265c3f8e080075d9b6417aa72293fc71662f34b4af2612d8d1b074d29510db" +checksum = "0da8964ace4d3e4a044fd027919b2237000b24315a37c916f61809f1ff2140b9" dependencies = [ "winapi", ] @@ -1709,9 +1709,9 @@ dependencies = [ [[package]] name = "termbg" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "133c09f40b7a6a10616bb46d2b7d78d50cb8c6c475c84f3c02fe261957d9e0e0" +checksum = "7e7fa67e879d2b5c902517367809bfab4e69ee6cabc03909141003721bd64282" dependencies = [ "crossterm", "thiserror", @@ -2290,13 +2290,8 @@ name = "zellij" version = "0.12.0" dependencies = [ "insta", - "interprocess", - "nix", - "structopt", - "vte 0.10.1", "zellij-client", "zellij-server", - "zellij-tile", "zellij-utils", ] @@ -2304,13 +2299,7 @@ dependencies = [ name = "zellij-client" version = "0.12.0" dependencies = [ - "interprocess", - "libc", - "nix", - "signal-hook 0.3.8", "termbg", - "termion", - "zellij-tile", "zellij-utils", ] @@ -2319,22 +2308,12 @@ name = "zellij-server" version = "0.12.0" dependencies = [ "ansi_term 0.12.1", - "async-std", "daemonize", "insta", - "interprocess", - "libc", - "nix", - "serde", "serde_json", - "serde_yaml", - "signal-hook 0.3.8", - "termion", "unicode-width", - "vte 0.10.1", "wasmer", "wasmer-wasi", - "zellij-tile", "zellij-utils", ] @@ -2366,14 +2345,17 @@ dependencies = [ "directories-next", "interprocess", "lazy_static", + "libc", "names", "nix", "serde", "serde_yaml", + "signal-hook 0.3.8", "strip-ansi-escapes", "structopt", "strum", "tempfile", "termion", + "vte 0.10.1", "zellij-tile", ] diff --git a/Cargo.toml b/Cargo.toml index 231b480a3..9e7e31ab4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,14 +13,9 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -zellij-utils = { path = "zellij-utils/", version = "0.12.0" } zellij-client = { path = "zellij-client/", version = "0.12.0" } zellij-server = { path = "zellij-server/", version = "0.12.0" } -zellij-tile = { path = "zellij-tile/", version = "0.12.0" } -structopt = "0.3" -interprocess = "1.1.1" -vte = "0.10.1" -nix = "0.19.1" +zellij-utils = { path = "zellij-utils/", version = "0.12.0" } [dev-dependencies] insta = "1.6.0" @@ -28,9 +23,6 @@ zellij-utils = { path = "zellij-utils/", version = "*", features = ["test"] } zellij-client = { path = "zellij-client/", version = "*", features = ["test"] } zellij-server = { path = "zellij-server/", version = "*", features = ["test"] } -[build-dependencies] -structopt = "0.3" - [workspace] members = [ "zellij-client", diff --git a/src/main.rs b/src/main.rs index b5dd213f7..a970ce446 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,6 @@ mod tests; use std::convert::TryFrom; -use structopt::StructOpt; use zellij_client::{os_input_output::get_client_os_input, start_client}; use zellij_server::{os_input_output::get_server_os_input, start_server}; use zellij_utils::{ @@ -11,6 +10,7 @@ use zellij_utils::{ input::config::Config, logging::*, setup::Setup, + structopt::StructOpt, }; pub fn main() { diff --git a/src/tests/fakes.rs b/src/tests/fakes.rs index 44c0b2ce2..e9042ed73 100644 --- a/src/tests/fakes.rs +++ b/src/tests/fakes.rs @@ -1,18 +1,21 @@ -use crate::tests::possible_tty_inputs::{get_possible_tty_inputs, Bytes}; -use crate::tests::utils::commands::{QUIT, SLEEP}; -use interprocess::local_socket::LocalSocketStream; use std::collections::{HashMap, VecDeque}; use std::io::Write; use std::os::unix::io::RawFd; use std::path::PathBuf; use std::sync::{mpsc, Arc, Condvar, Mutex}; use std::time::{Duration, Instant}; + +use zellij_utils::{nix, zellij_tile}; + +use crate::tests::possible_tty_inputs::{get_possible_tty_inputs, Bytes}; +use crate::tests::utils::commands::{QUIT, SLEEP}; use zellij_client::os_input_output::ClientOsApi; use zellij_server::os_input_output::{Pid, ServerOsApi}; use zellij_tile::data::Palette; use zellij_utils::{ channels::{ChannelWithContext, SenderType, SenderWithContext}, errors::ErrorContext, + interprocess::local_socket::LocalSocketStream, ipc::{ClientToServerMsg, ServerToClientMsg}, pane_size::PositionAndSize, shared::default_palette, diff --git a/src/tests/utils.rs b/src/tests/utils.rs index 441f9bcea..6267c883a 100644 --- a/src/tests/utils.rs +++ b/src/tests/utils.rs @@ -1,3 +1,5 @@ +use zellij_utils::{vte, zellij_tile}; + use zellij_server::{panes::TerminalPane, tab::Pane}; use zellij_tile::data::Palette; use zellij_utils::pane_size::PositionAndSize; diff --git a/zellij-client/Cargo.toml b/zellij-client/Cargo.toml index 5d7efdddc..f9d0db086 100644 --- a/zellij-client/Cargo.toml +++ b/zellij-client/Cargo.toml @@ -9,14 +9,8 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +termbg = "0.2.3" zellij-utils = { path = "../zellij-utils/", version = "0.12.0" } -zellij-tile = { path = "../zellij-tile/", version = "0.12.0" } -termion = "1.5.0" -signal-hook = "0.3" -nix = "0.19.1" -interprocess = "1.1.1" -libc = "0.2" -termbg = "0.2.0" [features] test = ["zellij-utils/test"] diff --git a/zellij-client/src/input_handler.rs b/zellij-client/src/input_handler.rs index e67bdf829..4e2cff94c 100644 --- a/zellij-client/src/input_handler.rs +++ b/zellij-client/src/input_handler.rs @@ -1,5 +1,7 @@ //! Main input logic. +use zellij_utils::{termion, zellij_tile}; + use crate::{os_input_output::ClientOsApi, ClientInstruction, CommandIsExecuting}; use zellij_utils::{ channels::{SenderWithContext, OPENCALLS}, diff --git a/zellij-client/src/os_input_output.rs b/zellij-client/src/os_input_output.rs index 02a516e8a..9d8617f5f 100644 --- a/zellij-client/src/os_input_output.rs +++ b/zellij-client/src/os_input_output.rs @@ -1,3 +1,5 @@ +use zellij_utils::{interprocess, libc, nix, signal_hook, zellij_tile}; + use interprocess::local_socket::LocalSocketStream; use nix::pty::Winsize; use nix::sys::termios; @@ -8,12 +10,12 @@ use std::os::unix::io::RawFd; use std::path::Path; use std::sync::{Arc, Mutex}; use zellij_tile::data::{Palette, PaletteColor}; -use zellij_utils::errors::ErrorContext; -use zellij_utils::ipc::{ - ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg, +use zellij_utils::{ + errors::ErrorContext, + ipc::{ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg}, + pane_size::PositionAndSize, + shared::default_palette, }; -use zellij_utils::pane_size::PositionAndSize; -use zellij_utils::shared::default_palette; fn into_raw_mode(pid: RawFd) { let mut tio = termios::tcgetattr(pid).expect("could not get terminal attribute"); diff --git a/zellij-server/Cargo.toml b/zellij-server/Cargo.toml index 97930c75b..532ef9317 100644 --- a/zellij-server/Cargo.toml +++ b/zellij-server/Cargo.toml @@ -9,26 +9,13 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde = { version = "1.0", features = ["derive"] } +ansi_term = "0.12.1" +daemonize = "0.4.1" +serde_json = "1.0" +unicode-width = "0.1.8" wasmer = "1.0.0" wasmer-wasi = "1.0.0" -zellij-tile = { path = "../zellij-tile/", version = "0.12.0" } zellij-utils = { path = "../zellij-utils/", version = "0.12.0" } -vte = "0.10.1" -unicode-width = "0.1.8" -ansi_term = "0.12.1" -serde_yaml = "0.8" -nix = "0.19.1" -termion = "1.5.0" -signal-hook = "0.3" -libc = "0.2" -serde_json = "1.0" -daemonize = "0.4.1" -interprocess = "1.1.1" - -[dependencies.async-std] -version = "1.3.0" -features = ["unstable"] [dev-dependencies] insta = "1.6.0" diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 8d82313db..df0eea65f 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -9,6 +9,8 @@ mod thread_bus; mod ui; mod wasm_vm; +use zellij_utils::zellij_tile; + use std::sync::{Arc, RwLock}; use std::thread; use std::{path::PathBuf, sync::mpsc}; @@ -131,8 +133,9 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { let _ = thread::Builder::new() .name("server_listener".to_string()) .spawn({ - use interprocess::local_socket::LocalSocketListener; - use zellij_utils::shared::set_permissions; + use zellij_utils::{ + interprocess::local_socket::LocalSocketListener, shared::set_permissions, + }; let os_input = os_input.clone(); let sessions = sessions.clone(); diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs index bd5e9a486..be51878ce 100644 --- a/zellij-server/src/os_input_output.rs +++ b/zellij-server/src/os_input_output.rs @@ -1,3 +1,11 @@ +use std::env; +use std::os::unix::io::RawFd; +use std::path::PathBuf; +use std::process::{Child, Command}; +use std::sync::{Arc, Mutex}; + +use zellij_utils::{interprocess, libc, nix, signal_hook, zellij_tile}; + use interprocess::local_socket::LocalSocketStream; use nix::fcntl::{fcntl, FcntlArg, OFlag}; use nix::pty::{forkpty, Winsize}; @@ -6,17 +14,12 @@ use nix::sys::termios; use nix::sys::wait::waitpid; use nix::unistd::{self, ForkResult}; use signal_hook::consts::*; -use std::env; -use std::os::unix::io::RawFd; -use std::path::PathBuf; -use std::process::{Child, Command}; -use std::sync::{Arc, Mutex}; use zellij_tile::data::Palette; -use zellij_utils::errors::ErrorContext; -use zellij_utils::ipc::{ - ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg, +use zellij_utils::{ + errors::ErrorContext, + ipc::{ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg}, + shared::default_palette, }; -use zellij_utils::shared::default_palette; pub use nix::unistd::Pid; pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) { @@ -37,7 +40,7 @@ pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) { /// process exits. fn handle_command_exit(mut child: Child) { // register the SIGINT signal (TODO handle more signals) - let mut signals = ::signal_hook::iterator::Signals::new(&[SIGINT]).unwrap(); + let mut signals = signal_hook::iterator::Signals::new(&[SIGINT]).unwrap(); 'handle_exit: loop { // test whether the child process has exited match child.try_wait() { diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index d9cef5def..ac347db0e 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -5,11 +5,12 @@ use std::{ str, }; -use vte::{Params, Perform}; +use zellij_utils::{vte, zellij_tile}; const TABSTOP_WIDTH: usize = 8; // TODO: is this always right? const SCROLL_BACK: usize = 10_000; +use vte::{Params, Perform}; use zellij_tile::data::{Palette, PaletteColor}; use zellij_utils::{consts::VERSION, logging::debug_log_to_file, shared::version_number}; diff --git a/zellij-server/src/panes/terminal_character.rs b/zellij-server/src/panes/terminal_character.rs index c55569f05..e6489eb42 100644 --- a/zellij-server/src/panes/terminal_character.rs +++ b/zellij-server/src/panes/terminal_character.rs @@ -3,8 +3,8 @@ use unicode_width::UnicodeWidthChar; use std::convert::TryFrom; use std::fmt::{self, Debug, Display, Formatter}; use std::ops::{Index, IndexMut}; -use vte::ParamsIter; use zellij_utils::logging::debug_log_to_file; +use zellij_utils::vte::ParamsIter; pub const EMPTY_TERMINAL_CHARACTER: TerminalCharacter = TerminalCharacter { character: ' ', diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs index eaeb00264..7e45c77bb 100644 --- a/zellij-server/src/panes/terminal_pane.rs +++ b/zellij-server/src/panes/terminal_pane.rs @@ -1,3 +1,5 @@ +use zellij_utils::{vte, zellij_tile}; + use std::fmt::Debug; use std::os::unix::io::RawFd; use std::time::Instant; diff --git a/zellij-server/src/panes/unit/grid_tests.rs b/zellij-server/src/panes/unit/grid_tests.rs index 7612a05d1..1a1d7f5cc 100644 --- a/zellij-server/src/panes/unit/grid_tests.rs +++ b/zellij-server/src/panes/unit/grid_tests.rs @@ -1,6 +1,6 @@ use super::super::Grid; use ::insta::assert_snapshot; -use zellij_tile::data::Palette; +use zellij_utils::{vte, zellij_tile::data::Palette}; fn read_fixture(fixture_name: &str) -> Vec<u8> { let mut path_to_file = std::path::PathBuf::new(); diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 9bf1bddfd..ecaef460a 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -1,3 +1,5 @@ +use zellij_utils::{async_std, nix}; + use async_std::stream::*; use async_std::task; use async_std::task::*; diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index daa0c0ead..0187d9536 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -1,6 +1,6 @@ use std::sync::{Arc, RwLock}; -use zellij_tile::data::Event; +use zellij_utils::zellij_tile::data::Event; use crate::{ os_input_output::ServerOsApi, pty::PtyInstruction, screen::ScreenInstruction, diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 0500d296d..830c42511 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -4,6 +4,8 @@ use std::collections::BTreeMap; use std::os::unix::io::RawFd; use std::str; +use zellij_utils::zellij_tile; + use crate::{ panes::PaneId, pty::{PtyInstruction, VteBytes}, diff --git a/zellij-server/src/tab.rs b/zellij-server/src/tab.rs index 78586d7a7..e6953bfa2 100644 --- a/zellij-server/src/tab.rs +++ b/zellij-server/src/tab.rs @@ -1,6 +1,8 @@ //! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size, //! as well as how they should be resized +use zellij_utils::{serde, zellij_tile}; + use crate::{ os_input_output::ServerOsApi, panes::{PaneId, PluginPane, TerminalPane}, @@ -78,6 +80,7 @@ pub(crate) struct Tab { } #[derive(Clone, Debug, Default, Serialize, Deserialize)] +#[serde(crate = "self::serde")] pub(crate) struct TabData { /* subset of fields to publish to plugins */ pub position: usize, diff --git a/zellij-server/src/ui/boundaries.rs b/zellij-server/src/ui/boundaries.rs index 984b13762..42a80ace1 100644 --- a/zellij-server/src/ui/boundaries.rs +++ b/zellij-server/src/ui/boundaries.rs @@ -1,3 +1,5 @@ +use zellij_utils::zellij_tile; + use crate::tab::Pane; use ansi_term::Colour::{Fixed, RGB}; use std::collections::HashMap; diff --git a/zellij-server/src/ui/layout.rs b/zellij-server/src/ui/layout.rs index 3965b478c..a9af665fa 100644 --- a/zellij-server/src/ui/layout.rs +++ b/zellij-server/src/ui/layout.rs @@ -1,3 +1,5 @@ +use zellij_utils::{serde, serde_yaml}; + use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use std::{fs::File, io::prelude::*}; @@ -167,18 +169,21 @@ fn split_space( } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(crate = "self::serde")] pub(crate) enum Direction { Horizontal, Vertical, } #[derive(Debug, Serialize, Deserialize, Clone, Copy)] +#[serde(crate = "self::serde")] pub(crate) enum SplitSize { Percent(u8), // 1 to 100 Fixed(u16), // An absolute number of columns or rows } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(crate = "self::serde")] pub(crate) struct Layout { pub direction: Direction, #[serde(default, skip_serializing_if = "Vec::is_empty")] diff --git a/zellij-server/src/wasm_vm.rs b/zellij-server/src/wasm_vm.rs index 65f5358ad..53dceaa75 100644 --- a/zellij-server/src/wasm_vm.rs +++ b/zellij-server/src/wasm_vm.rs @@ -7,6 +7,8 @@ use std::sync::{mpsc::Sender, Arc, Mutex}; use std::thread; use std::time::{Duration, Instant}; +use zellij_utils::{serde, zellij_tile}; + use serde::{de::DeserializeOwned, Serialize}; use wasmer::{ imports, ChainableNamedResolver, Function, ImportObject, Instance, Module, Store, Value, diff --git a/zellij-utils/Cargo.toml b/zellij-utils/Cargo.toml index d33ac659d..b1f48d10b 100644 --- a/zellij-utils/Cargo.toml +++ b/zellij-utils/Cargo.toml @@ -11,19 +11,22 @@ license = "MIT" [dependencies] backtrace = "0.3.55" bincode = "1.3.1" +colors-transform = "0.2.5" +directories-next = "2.0" interprocess = "1.1.1" -structopt = "0.3" -serde = { version = "1.0", features = ["derive"] } -zellij-tile = { path = "../zellij-tile/", version = "0.12.0" } +lazy_static = "1.4.0" +libc = "0.2" names = "0.11.0" -colors-transform = "0.2.5" +nix = "0.19.1" +serde = { version = "1.0", features = ["derive"] } +serde_yaml = "0.8" +signal-hook = "0.3" strip-ansi-escapes = "0.1.0" +structopt = "0.3" strum = "0.20.0" -serde_yaml = "0.8" -nix = "0.19.1" -lazy_static = "1.4.0" -directories-next = "2.0" termion = "1.5.0" +vte = "0.10.1" +zellij-tile = { path = "../zellij-tile/", version = "0.12.0" } [dependencies.async-std] version = "1.3.0" diff --git a/zellij-utils/src/lib.rs b/zellij-utils/src/lib.rs index 35f27244a..6285047fe 100644 --- a/zellij-utils/src/lib.rs +++ b/zellij-utils/src/lib.rs @@ -8,3 +8,15 @@ pub mod logging; pub mod pane_size; pub mod setup; pub mod shared; + +pub use async_std; +pub use interprocess; +pub use libc; +pub use nix; +pub use serde; +pub use serde_yaml; +pub use signal_hook; +pub use structopt; +pub use termion; +pub use vte; +pub use zellij_tile; |