Work towards a functional build

This commit is contained in:
Brooks J Rady 2021-02-09 19:06:47 +00:00
parent dc9e2b1e6c
commit 678a6f877c
11 changed files with 2254 additions and 27 deletions

2229
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

9
Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[workspace]
members = [
"zellij",
"zellij-tile",
"default-tiles/*",
]
[profile.release]
lto = true

View file

@ -7,7 +7,4 @@ license = "MIT"
[dependencies] [dependencies]
colored = "2" colored = "2"
mosaic-tile = "0.4" zellij-tile = { path = "../../zellij-tile" }
[profile.release]
lto = true

View file

@ -1,5 +1,5 @@
use colored::*; use colored::*;
use mosaic_tile::*; use zellij_tile::*;
use std::fmt::{Display, Formatter, Error}; use std::fmt::{Display, Formatter, Error};
// for more of these, copy paste from: https://en.wikipedia.org/wiki/Box-drawing_character // for more of these, copy paste from: https://en.wikipedia.org/wiki/Box-drawing_character
@ -262,7 +262,7 @@ fn keybinds(help: &Help, max_width: usize) -> LinePart {
} }
} }
impl MosaicTile for State { impl ZellijTile for State {
fn init(&mut self) { fn init(&mut self) {
set_selectable(false); set_selectable(false);
set_invisible_borders(true); set_invisible_borders(true);

View file

@ -1,16 +1,12 @@
[package] [package]
name = "module" name = "strider"
version = "0.2.0" version = "0.2.0"
authors = ["Brooks J Rady <b.j.rady@gmail.com>"] authors = ["Brooks J Rady <b.j.rady@gmail.com>"]
edition = "2018" edition = "2018"
description = "A simplified ranger clone written as a mosaic tile" description = "A simplified ranger clone written as a Zellij tile"
repository = "https://github.com/mosaic-org/strider"
license = "MIT" license = "MIT"
[dependencies] [dependencies]
colored = "2" colored = "2"
mosaic-tile = "0.4" zellij-tile = { path = "../../zellij-tile" }
pretty-bytes = "0.2" pretty-bytes = "0.2"
[profile.release]
lto = true

View file

@ -1,13 +1,13 @@
mod state; mod state;
use colored::*; use colored::*;
use mosaic_tile::*; use zellij_tile::*;
use state::{FsEntry, State}; use state::{FsEntry, State};
use std::{cmp::min, fs::read_dir}; use std::{cmp::min, fs::read_dir};
register_tile!(State); register_tile!(State);
impl MosaicTile for State { impl ZellijTile for State {
fn init(&mut self) { fn init(&mut self) {
refresh_directory(self); refresh_directory(self);
} }

View file

@ -1,10 +1,9 @@
[package] [package]
name = "mosaic-tile" name = "zellij-tile"
version = "0.4.0" version = "0.5.0"
authors = ["Brooks J Rady <b.j.rady@gmail.com>"] authors = ["Brooks J Rady <b.j.rady@gmail.com>"]
edition = "2018" edition = "2018"
description = "A small client-side library for writing mosaic plugins (tiles)" description = "A small client-side library for writing Zellij plugins (tiles)"
repository = "https://github.com/mosaic-org/mosaic-tile"
license = "MIT" license = "MIT"
[dependencies] [dependencies]

View file

@ -2,7 +2,7 @@ mod shim;
pub use shim::*; pub use shim::*;
#[allow(unused_variables)] #[allow(unused_variables)]
pub trait MosaicTile { pub trait ZellijTile {
fn init(&mut self) {} fn init(&mut self) {}
fn draw(&mut self, rows: usize, cols: usize) {} fn draw(&mut self, rows: usize, cols: usize) {}
fn handle_key(&mut self, key: Key) {} fn handle_key(&mut self, key: Key) {}

View file

@ -84,7 +84,7 @@ fn deserialize_from_stdin<T: DeserializeOwned>() -> Option<T> {
serde_json::from_str(&json).ok() serde_json::from_str(&json).ok()
} }
#[link(wasm_import_module = "mosaic")] #[link(wasm_import_module = "zellij")]
extern "C" { extern "C" {
fn host_open_file(); fn host_open_file();
fn host_set_max_height(max_height: i32); fn host_set_max_height(max_height: i32);

View file

@ -1,5 +1,5 @@
[package] [package]
name = "mosaic" name = "zellij"
version = "0.1.0" version = "0.1.0"
authors = ["Aram Drevekenin <aram@poor.dev>"] authors = ["Aram Drevekenin <aram@poor.dev>"]
edition = "2018" edition = "2018"
@ -43,9 +43,6 @@ insta = "0.16.1"
directories-next = "2.0" directories-next = "2.0"
structopt = "0.3" structopt = "0.3"
[profile.release]
lto = true
[package.metadata.deb] [package.metadata.deb]
depends = "$auto" depends = "$auto"
license-file = ["LICENSE.md", "4"] license-file = ["LICENSE.md", "4"]

View file

@ -35,7 +35,7 @@ pub struct PluginEnv {
pub fn mosaic_imports(store: &Store, plugin_env: &PluginEnv) -> ImportObject { pub fn mosaic_imports(store: &Store, plugin_env: &PluginEnv) -> ImportObject {
imports! { imports! {
"mosaic" => { "zellij" => {
"host_open_file" => Function::new_native_with_env(store, plugin_env.clone(), host_open_file), "host_open_file" => Function::new_native_with_env(store, plugin_env.clone(), host_open_file),
"host_set_invisible_borders" => Function::new_native_with_env(store, plugin_env.clone(), host_set_invisible_borders), "host_set_invisible_borders" => Function::new_native_with_env(store, plugin_env.clone(), host_set_invisible_borders),
"host_set_max_height" => Function::new_native_with_env(store, plugin_env.clone(), host_set_max_height), "host_set_max_height" => Function::new_native_with_env(store, plugin_env.clone(), host_set_max_height),