Re-export common dependencies from zellij-utils

This commit is contained in:
Kunal Mohan 2021-05-18 22:16:23 +05:30
parent d202cb7394
commit 040d10df0f
24 changed files with 93 additions and 85 deletions

23
Cargo.lock generated
View file

@ -2290,13 +2290,9 @@ name = "zellij"
version = "0.12.0" version = "0.12.0"
dependencies = [ dependencies = [
"insta", "insta",
"interprocess",
"nix",
"structopt", "structopt",
"vte 0.10.1",
"zellij-client", "zellij-client",
"zellij-server", "zellij-server",
"zellij-tile",
"zellij-utils", "zellij-utils",
] ]
@ -2304,13 +2300,7 @@ dependencies = [
name = "zellij-client" name = "zellij-client"
version = "0.12.0" version = "0.12.0"
dependencies = [ dependencies = [
"interprocess",
"libc",
"nix",
"signal-hook 0.3.8",
"termbg", "termbg",
"termion",
"zellij-tile",
"zellij-utils", "zellij-utils",
] ]
@ -2319,22 +2309,12 @@ name = "zellij-server"
version = "0.12.0" version = "0.12.0"
dependencies = [ dependencies = [
"ansi_term 0.12.1", "ansi_term 0.12.1",
"async-std",
"daemonize", "daemonize",
"insta", "insta",
"interprocess",
"libc",
"nix",
"serde",
"serde_json", "serde_json",
"serde_yaml",
"signal-hook 0.3.8",
"termion",
"unicode-width", "unicode-width",
"vte 0.10.1",
"wasmer", "wasmer",
"wasmer-wasi", "wasmer-wasi",
"zellij-tile",
"zellij-utils", "zellij-utils",
] ]
@ -2366,14 +2346,17 @@ dependencies = [
"directories-next", "directories-next",
"interprocess", "interprocess",
"lazy_static", "lazy_static",
"libc",
"names", "names",
"nix", "nix",
"serde", "serde",
"serde_yaml", "serde_yaml",
"signal-hook 0.3.8",
"strip-ansi-escapes", "strip-ansi-escapes",
"structopt", "structopt",
"strum", "strum",
"tempfile", "tempfile",
"termion", "termion",
"vte 0.10.1",
"zellij-tile", "zellij-tile",
] ]

View file

@ -13,14 +13,9 @@ resolver = "2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
zellij-utils = { path = "zellij-utils/", version = "0.12.0" }
zellij-client = { path = "zellij-client/", version = "0.12.0" } zellij-client = { path = "zellij-client/", version = "0.12.0" }
zellij-server = { path = "zellij-server/", version = "0.12.0" } zellij-server = { path = "zellij-server/", version = "0.12.0" }
zellij-tile = { path = "zellij-tile/", version = "0.12.0" } zellij-utils = { path = "zellij-utils/", version = "0.12.0" }
structopt = "0.3"
interprocess = "1.1.1"
vte = "0.10.1"
nix = "0.19.1"
[dev-dependencies] [dev-dependencies]
insta = "1.6.0" insta = "1.6.0"

View file

@ -2,7 +2,6 @@
mod tests; mod tests;
use std::convert::TryFrom; use std::convert::TryFrom;
use structopt::StructOpt;
use zellij_client::{os_input_output::get_client_os_input, start_client}; 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_server::{os_input_output::get_server_os_input, start_server};
use zellij_utils::{ use zellij_utils::{
@ -11,6 +10,7 @@ use zellij_utils::{
input::config::Config, input::config::Config,
logging::*, logging::*,
setup::Setup, setup::Setup,
structopt::StructOpt,
}; };
pub fn main() { pub fn main() {

View file

@ -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::collections::{HashMap, VecDeque};
use std::io::Write; use std::io::Write;
use std::os::unix::io::RawFd; use std::os::unix::io::RawFd;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::{mpsc, Arc, Condvar, Mutex}; use std::sync::{mpsc, Arc, Condvar, Mutex};
use std::time::{Duration, Instant}; 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_client::os_input_output::ClientOsApi;
use zellij_server::os_input_output::ServerOsApi; use zellij_server::os_input_output::ServerOsApi;
use zellij_tile::data::Palette; use zellij_tile::data::Palette;
use zellij_utils::{ use zellij_utils::{
channels::{ChannelWithContext, SenderType, SenderWithContext}, channels::{ChannelWithContext, SenderType, SenderWithContext},
errors::ErrorContext, errors::ErrorContext,
interprocess::local_socket::LocalSocketStream,
ipc::{ClientToServerMsg, ServerToClientMsg}, ipc::{ClientToServerMsg, ServerToClientMsg},
pane_size::PositionAndSize, pane_size::PositionAndSize,
shared::default_palette, shared::default_palette,

View file

@ -1,3 +1,5 @@
use zellij_utils::{vte, zellij_tile};
use zellij_server::{panes::TerminalPane, tab::Pane}; use zellij_server::{panes::TerminalPane, tab::Pane};
use zellij_tile::data::Palette; use zellij_tile::data::Palette;
use zellij_utils::pane_size::PositionAndSize; use zellij_utils::pane_size::PositionAndSize;

View file

@ -9,14 +9,8 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
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" termbg = "0.2.0"
zellij-utils = { path = "../zellij-utils/", version = "0.12.0" }
[features] [features]
test = ["zellij-utils/test"] test = ["zellij-utils/test"]

View file

@ -1,5 +1,7 @@
//! Main input logic. //! Main input logic.
use zellij_utils::{termion, zellij_tile};
use crate::{os_input_output::ClientOsApi, ClientInstruction, CommandIsExecuting}; use crate::{os_input_output::ClientOsApi, ClientInstruction, CommandIsExecuting};
use zellij_utils::{ use zellij_utils::{
channels::{SenderWithContext, OPENCALLS}, channels::{SenderWithContext, OPENCALLS},

View file

@ -1,3 +1,5 @@
use zellij_utils::{interprocess, libc, nix, signal_hook, zellij_tile};
use interprocess::local_socket::LocalSocketStream; use interprocess::local_socket::LocalSocketStream;
use nix::pty::Winsize; use nix::pty::Winsize;
use nix::sys::termios; use nix::sys::termios;
@ -8,12 +10,12 @@ use std::os::unix::io::RawFd;
use std::path::Path; use std::path::Path;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use zellij_tile::data::{Palette, PaletteColor}; use zellij_tile::data::{Palette, PaletteColor};
use zellij_utils::errors::ErrorContext; use zellij_utils::{
use zellij_utils::ipc::{ errors::ErrorContext,
ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg, 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) { fn into_raw_mode(pid: RawFd) {
let mut tio = termios::tcgetattr(pid).expect("could not get terminal attribute"); let mut tio = termios::tcgetattr(pid).expect("could not get terminal attribute");

View file

@ -9,26 +9,13 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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 = "1.0.0"
wasmer-wasi = "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" } 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] [dev-dependencies]
insta = "1.6.0" insta = "1.6.0"

View file

@ -9,6 +9,8 @@ mod thread_bus;
mod ui; mod ui;
mod wasm_vm; mod wasm_vm;
use zellij_utils::zellij_tile;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use std::thread; use std::thread;
use std::{path::PathBuf, sync::mpsc}; 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() let _ = thread::Builder::new()
.name("server_listener".to_string()) .name("server_listener".to_string())
.spawn({ .spawn({
use interprocess::local_socket::LocalSocketListener; use zellij_utils::{
use zellij_utils::shared::set_permissions; interprocess::local_socket::LocalSocketListener, shared::set_permissions,
};
let os_input = os_input.clone(); let os_input = os_input.clone();
let sessions = sessions.clone(); let sessions = sessions.clone();

View file

@ -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 interprocess::local_socket::LocalSocketStream;
use nix::fcntl::{fcntl, FcntlArg, OFlag}; use nix::fcntl::{fcntl, FcntlArg, OFlag};
use nix::pty::{forkpty, Winsize}; use nix::pty::{forkpty, Winsize};
@ -6,17 +14,12 @@ use nix::sys::termios;
use nix::sys::wait::waitpid; use nix::sys::wait::waitpid;
use nix::unistd::{self, ForkResult, Pid}; use nix::unistd::{self, ForkResult, Pid};
use signal_hook::consts::*; 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_tile::data::Palette;
use zellij_utils::errors::ErrorContext; use zellij_utils::{
use zellij_utils::ipc::{ errors::ErrorContext,
ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg, ipc::{ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg},
shared::default_palette,
}; };
use zellij_utils::shared::default_palette;
pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) { pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) {
// TODO: do this with the nix ioctl // TODO: do this with the nix ioctl
@ -36,7 +39,7 @@ pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) {
/// process exits. /// process exits.
fn handle_command_exit(mut child: Child) { fn handle_command_exit(mut child: Child) {
// register the SIGINT signal (TODO handle more signals) // 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 { 'handle_exit: loop {
// test whether the child process has exited // test whether the child process has exited
match child.try_wait() { match child.try_wait() {

View file

@ -5,11 +5,12 @@ use std::{
str, str,
}; };
use vte::{Params, Perform}; use zellij_utils::{vte, zellij_tile};
const TABSTOP_WIDTH: usize = 8; // TODO: is this always right? const TABSTOP_WIDTH: usize = 8; // TODO: is this always right?
const SCROLL_BACK: usize = 10_000; const SCROLL_BACK: usize = 10_000;
use vte::{Params, Perform};
use zellij_tile::data::{Palette, PaletteColor}; use zellij_tile::data::{Palette, PaletteColor};
use zellij_utils::{consts::VERSION, logging::debug_log_to_file, shared::version_number}; use zellij_utils::{consts::VERSION, logging::debug_log_to_file, shared::version_number};

View file

@ -3,8 +3,8 @@ use unicode_width::UnicodeWidthChar;
use std::convert::TryFrom; use std::convert::TryFrom;
use std::fmt::{self, Debug, Display, Formatter}; use std::fmt::{self, Debug, Display, Formatter};
use std::ops::{Index, IndexMut}; use std::ops::{Index, IndexMut};
use vte::ParamsIter;
use zellij_utils::logging::debug_log_to_file; use zellij_utils::logging::debug_log_to_file;
use zellij_utils::vte::ParamsIter;
pub const EMPTY_TERMINAL_CHARACTER: TerminalCharacter = TerminalCharacter { pub const EMPTY_TERMINAL_CHARACTER: TerminalCharacter = TerminalCharacter {
character: ' ', character: ' ',

View file

@ -1,3 +1,5 @@
use zellij_utils::{vte, zellij_tile};
use std::fmt::Debug; use std::fmt::Debug;
use std::os::unix::io::RawFd; use std::os::unix::io::RawFd;
use std::time::Instant; use std::time::Instant;

View file

@ -1,6 +1,6 @@
use super::super::Grid; use super::super::Grid;
use ::insta::assert_snapshot; 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> { fn read_fixture(fixture_name: &str) -> Vec<u8> {
let mut path_to_file = std::path::PathBuf::new(); let mut path_to_file = std::path::PathBuf::new();

View file

@ -1,3 +1,5 @@
use zellij_utils::{async_std, nix};
use async_std::stream::*; use async_std::stream::*;
use async_std::task; use async_std::task;
use async_std::task::*; use async_std::task::*;

View file

@ -1,6 +1,6 @@
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use zellij_tile::data::Event; use zellij_utils::zellij_tile::data::Event;
use crate::{ use crate::{
os_input_output::ServerOsApi, pty::PtyInstruction, screen::ScreenInstruction, os_input_output::ServerOsApi, pty::PtyInstruction, screen::ScreenInstruction,

View file

@ -4,6 +4,8 @@ use std::collections::BTreeMap;
use std::os::unix::io::RawFd; use std::os::unix::io::RawFd;
use std::str; use std::str;
use zellij_utils::zellij_tile;
use crate::{ use crate::{
panes::PaneId, panes::PaneId,
pty::{PtyInstruction, VteBytes}, pty::{PtyInstruction, VteBytes},

View file

@ -1,6 +1,8 @@
//! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size, //! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size,
//! as well as how they should be resized //! as well as how they should be resized
use zellij_utils::{serde, zellij_tile};
use crate::{ use crate::{
os_input_output::ServerOsApi, os_input_output::ServerOsApi,
panes::{PaneId, PluginPane, TerminalPane}, panes::{PaneId, PluginPane, TerminalPane},
@ -78,6 +80,7 @@ pub(crate) struct Tab {
} }
#[derive(Clone, Debug, Default, Serialize, Deserialize)] #[derive(Clone, Debug, Default, Serialize, Deserialize)]
#[serde(crate = "self::serde")]
pub(crate) struct TabData { pub(crate) struct TabData {
/* subset of fields to publish to plugins */ /* subset of fields to publish to plugins */
pub position: usize, pub position: usize,

View file

@ -1,3 +1,5 @@
use zellij_utils::zellij_tile;
use crate::tab::Pane; use crate::tab::Pane;
use ansi_term::Colour::{Fixed, RGB}; use ansi_term::Colour::{Fixed, RGB};
use std::collections::HashMap; use std::collections::HashMap;

View file

@ -1,3 +1,5 @@
use zellij_utils::{serde, serde_yaml};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::{fs::File, io::prelude::*}; use std::{fs::File, io::prelude::*};
@ -167,18 +169,21 @@ fn split_space(
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(crate = "self::serde")]
pub(crate) enum Direction { pub(crate) enum Direction {
Horizontal, Horizontal,
Vertical, Vertical,
} }
#[derive(Debug, Serialize, Deserialize, Clone, Copy)] #[derive(Debug, Serialize, Deserialize, Clone, Copy)]
#[serde(crate = "self::serde")]
pub(crate) enum SplitSize { pub(crate) enum SplitSize {
Percent(u8), // 1 to 100 Percent(u8), // 1 to 100
Fixed(u16), // An absolute number of columns or rows Fixed(u16), // An absolute number of columns or rows
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(crate = "self::serde")]
pub(crate) struct Layout { pub(crate) struct Layout {
pub direction: Direction, pub direction: Direction,
#[serde(default, skip_serializing_if = "Vec::is_empty")] #[serde(default, skip_serializing_if = "Vec::is_empty")]

View file

@ -7,6 +7,8 @@ use std::sync::{mpsc::Sender, Arc, Mutex};
use std::thread; use std::thread;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use zellij_utils::{serde, zellij_tile};
use serde::{de::DeserializeOwned, Serialize}; use serde::{de::DeserializeOwned, Serialize};
use wasmer::{ use wasmer::{
imports, ChainableNamedResolver, Function, ImportObject, Instance, Module, Store, Value, imports, ChainableNamedResolver, Function, ImportObject, Instance, Module, Store, Value,

View file

@ -11,19 +11,22 @@ license = "MIT"
[dependencies] [dependencies]
backtrace = "0.3.55" backtrace = "0.3.55"
bincode = "1.3.1" bincode = "1.3.1"
interprocess = "1.1.1"
structopt = "0.3"
serde = { version = "1.0", features = ["derive"] }
zellij-tile = { path = "../zellij-tile/", version = "0.12.0" }
names = "0.11.0"
colors-transform = "0.2.5" colors-transform = "0.2.5"
strip-ansi-escapes = "0.1.0"
strum = "0.20.0"
serde_yaml = "0.8"
nix = "0.19.1"
lazy_static = "1.4.0"
directories-next = "2.0" directories-next = "2.0"
interprocess = "1.1.1"
lazy_static = "1.4.0"
libc = "0.2"
names = "0.11.0"
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"
termion = "1.5.0" termion = "1.5.0"
vte = "0.10.1"
zellij-tile = { path = "../zellij-tile/", version = "0.12.0" }
[dependencies.async-std] [dependencies.async-std]
version = "1.3.0" version = "1.3.0"

View file

@ -8,3 +8,15 @@ pub mod logging;
pub mod pane_size; pub mod pane_size;
pub mod setup; pub mod setup;
pub mod shared; 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;