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]
colored = "2"
mosaic-tile = "0.4"
[profile.release]
lto = true
zellij-tile = { path = "../../zellij-tile" }

View file

@ -1,5 +1,5 @@
use colored::*;
use mosaic_tile::*;
use zellij_tile::*;
use std::fmt::{Display, Formatter, Error};
// 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) {
set_selectable(false);
set_invisible_borders(true);

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@ mod shim;
pub use shim::*;
#[allow(unused_variables)]
pub trait MosaicTile {
pub trait ZellijTile {
fn init(&mut self) {}
fn draw(&mut self, rows: usize, cols: usize) {}
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()
}
#[link(wasm_import_module = "mosaic")]
#[link(wasm_import_module = "zellij")]
extern "C" {
fn host_open_file();
fn host_set_max_height(max_height: i32);

View file

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

View file

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