diff options
| author | Brooks Rady <b.j.rady@gmail.com> | 2021-02-17 12:24:13 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-17 12:24:13 +0000 |
| commit | 8be470fbc0f39bb493678e1cff9b71950ff6e60b (patch) | |
| tree | df0cb7cac90380aef4f54184caf1192151fb089f /src | |
| parent | feat(input): new keybindings and persistent mode as default (#181) (diff) | |
| parent | Fix a silly bug in the build! (diff) | |
| download | sl0ppij-8be470fbc0f39bb493678e1cff9b71950ff6e60b.tar.gz sl0ppij-8be470fbc0f39bb493678e1cff9b71950ff6e60b.tar.xz sl0ppij-8be470fbc0f39bb493678e1cff9b71950ff6e60b.zip | |
infra(simplify build and install)
Merge pull request #186 from zellij-org/simplify-build-and-install
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/mod.rs | 2 | ||||
| -rw-r--r-- | src/common/install.rs | 12 | ||||
| -rw-r--r-- | src/common/ipc.rs | 2 | ||||
| -rw-r--r-- | src/common/mod.rs | 4 | ||||
| -rw-r--r-- | src/main.rs | 21 | ||||
| -rw-r--r-- | src/tests/integration/snapshots/zellij__tests__integration__layouts__accepts_basic_layout-3.snap | 4 |
6 files changed, 39 insertions, 6 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs index c8276253..93f35e06 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -3,4 +3,4 @@ pub mod layout; pub mod panes; pub mod tab; -pub fn start_client() {} +pub fn _start_client() {} diff --git a/src/common/install.rs b/src/common/install.rs new file mode 100644 index 00000000..4e3f5c5d --- /dev/null +++ b/src/common/install.rs @@ -0,0 +1,12 @@ +#[macro_export] +macro_rules! asset_map { + ($($path:literal),+) => { + { + let mut assets = std::collections::HashMap::new(); + $( + assets.insert($path, include_bytes!(concat!("../assets/", $path)).to_vec()); + )+ + assets + } + } +} diff --git a/src/common/ipc.rs b/src/common/ipc.rs index 425d81d6..3fa8c6b2 100644 --- a/src/common/ipc.rs +++ b/src/common/ipc.rs @@ -38,7 +38,7 @@ pub enum ClientToServerMsg { // Types of messages sent from the server to the client // @@@ Implement Serialize and Deserialize for this... -pub enum ServerToClientMsg { +pub enum _ServerToClientMsg { // Info about a particular session SessionInfo(Session), // A list of sessions diff --git a/src/common/mod.rs b/src/common/mod.rs index 00ee64fd..d1133e27 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -1,6 +1,7 @@ pub mod command_is_executing; pub mod errors; pub mod input; +pub mod install; pub mod ipc; pub mod os_input_output; pub mod pty_bus; @@ -416,6 +417,7 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) { let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap(); let plugin_dir = project_dirs.data_dir().join("plugins/"); + // FIXME: This really shouldn't need to exist anymore, let's get rid of it! let root_plugin_dir = Path::new(ZELLIJ_ROOT_PLUGIN_DIR); let wasm_bytes = fs::read(&path) .or_else(|_| fs::read(&path.with_extension("wasm"))) @@ -646,7 +648,7 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) { let restore_snapshot = "\u{1b}[?1049l"; let goto_start_of_last_line = format!("\u{1b}[{};{}H", full_screen_ws.rows, 1); let goodbye_message = format!( - "{}\n{}{}{}Bye from Zellij!", + "{}\n{}{}{}Bye from Zellij!\n", goto_start_of_last_line, restore_snapshot, reset_style, show_cursor ); diff --git a/src/main.rs b/src/main.rs index 50c0b6f3..27036e3d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,9 +11,10 @@ use common::{ command_is_executing, errors, os_input_output, pty_bus, screen, start, utils, wasm_vm, ApiCommand, }; +use directories_next::ProjectDirs; -use std::io::Write; use std::os::unix::net::UnixStream; +use std::{fs, io::Write}; use structopt::StructOpt; @@ -27,6 +28,24 @@ use crate::utils::{ }; pub fn main() { + // First run installation of default plugins & layouts + let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap(); + let data_dir = project_dirs.data_dir(); + let assets = asset_map! { + "plugins/status-bar.wasm", + "plugins/strider.wasm", + "layouts/default.yaml", + "layouts/strider.yaml" + }; + + for (path, bytes) in assets { + let path = data_dir.join(path); + fs::create_dir_all(path.parent().unwrap()).unwrap(); + if !path.exists() { + fs::write(path, bytes).expect("Failed to install default assets!"); + } + } + let opts = CliArgs::from_args(); if let Some(split_dir) = opts.split { match split_dir { diff --git a/src/tests/integration/snapshots/zellij__tests__integration__layouts__accepts_basic_layout-3.snap b/src/tests/integration/snapshots/zellij__tests__integration__layouts__accepts_basic_layout-3.snap index 0941f965..d506a47a 100644 --- a/src/tests/integration/snapshots/zellij__tests__integration__layouts__accepts_basic_layout-3.snap +++ b/src/tests/integration/snapshots/zellij__tests__integration__layouts__accepts_basic_layout-3.snap @@ -3,8 +3,8 @@ source: src/tests/integration/layouts.rs expression: last_snapshot --- -Bye from Zellij!█ - +Bye from Zellij! + █ |
