chore: added zellij-tile-extra, moved macros from zellij-tile

This commit is contained in:
denis 2021-05-02 12:57:48 +03:00
parent d48cc81536
commit 56cf446275
12 changed files with 52 additions and 17 deletions

10
Cargo.lock generated
View file

@ -1483,6 +1483,7 @@ dependencies = [
"ansi_term 0.12.1", "ansi_term 0.12.1",
"colored", "colored",
"zellij-tile", "zellij-tile",
"zellij-tile-extra",
] ]
[[package]] [[package]]
@ -1575,6 +1576,7 @@ dependencies = [
"ansi_term 0.12.1", "ansi_term 0.12.1",
"colored", "colored",
"zellij-tile", "zellij-tile",
"zellij-tile-extra",
] ]
[[package]] [[package]]
@ -2249,6 +2251,7 @@ dependencies = [
"wasmer-wasi", "wasmer-wasi",
"xrdb", "xrdb",
"zellij-tile", "zellij-tile",
"zellij-tile-extra",
] ]
[[package]] [[package]]
@ -2261,3 +2264,10 @@ dependencies = [
"strum", "strum",
"strum_macros", "strum_macros",
] ]
[[package]]
name = "zellij-tile-extra"
version = "1.0.0"
dependencies = [
"ansi_term 0.12.1",
]

View file

@ -39,6 +39,7 @@ interprocess = "1.0.1"
xrdb = "0.1.1" xrdb = "0.1.1"
colors-transform = "0.2.5" colors-transform = "0.2.5"
zellij-tile = { path = "zellij-tile/", version = "1.1.0" } zellij-tile = { path = "zellij-tile/", version = "1.1.0" }
zellij-tile-extra = { path = "zellij-tile-extra/", version="1.0.0" }
[dependencies.async-std] [dependencies.async-std]
version = "1.3.0" version = "1.3.0"
@ -54,6 +55,7 @@ structopt = "0.3"
[workspace] [workspace]
members = [ members = [
"zellij-tile", "zellij-tile",
"zellij-tile-extra",
"default-plugins/status-bar", "default-plugins/status-bar",
"default-plugins/strider", "default-plugins/strider",
"default-plugins/tab-bar", "default-plugins/tab-bar",

View file

@ -108,7 +108,7 @@ args = ["install", "cross"]
[tasks.publish] [tasks.publish]
clear = true clear = true
workspace = false workspace = false
dependencies = ["build-plugins-release", "wasm-opt-plugins", "build-release", "publish-zellij-tile"] dependencies = ["build-plugins-release", "wasm-opt-plugins", "build-release", "publish-zellij-tile", "publish-zellij-tile-extra"]
run_task = "publish-zellij" run_task = "publish-zellij"
[tasks.publish-zellij-tile] [tasks.publish-zellij-tile]
@ -117,6 +117,12 @@ cwd = "zellij-tile"
command = "cargo" command = "cargo"
args = ["publish"] args = ["publish"]
[tasks.publish-zellij-tile-extra]
ignore_errors = true
cwd = "zellij-tile-extra"
command = "cargo"
args = ["publish"]
[tasks.publish-zellij] [tasks.publish-zellij]
command = "cargo" command = "cargo"
args = ["publish"] args = ["publish"]

View file

@ -9,3 +9,4 @@ license = "MIT"
colored = "2" colored = "2"
ansi_term = "0.12" ansi_term = "0.12"
zellij-tile = { path = "../../zellij-tile" } zellij-tile = { path = "../../zellij-tile" }
zellij-tile-extra = { path = "../../zellij-tile-extra" }

View file

@ -5,6 +5,7 @@ use ansi_term::Style;
use std::fmt::{Display, Error, Formatter}; use std::fmt::{Display, Error, Formatter};
use zellij_tile::prelude::*; use zellij_tile::prelude::*;
use zellij_tile_extra::*;
use first_line::{ctrl_keys, superkey}; use first_line::{ctrl_keys, superkey};
use second_line::keybinds; use second_line::keybinds;

View file

@ -9,3 +9,4 @@ license = "MIT"
colored = "2" colored = "2"
ansi_term = "0.12" ansi_term = "0.12"
zellij-tile = { path = "../../zellij-tile" } zellij-tile = { path = "../../zellij-tile" }
zellij-tile-extra = { path = "../../zellij-tile-extra" }

View file

@ -2,6 +2,7 @@ use ansi_term::ANSIStrings;
use crate::{LinePart, ARROW_SEPARATOR}; use crate::{LinePart, ARROW_SEPARATOR};
use zellij_tile::prelude::*; use zellij_tile::prelude::*;
use zellij_tile_extra::*;
fn get_current_title_len(current_title: &[LinePart]) -> usize { fn get_current_title_len(current_title: &[LinePart]) -> usize {
current_title current_title

View file

@ -1,6 +1,7 @@
use crate::{LinePart, ARROW_SEPARATOR}; use crate::{LinePart, ARROW_SEPARATOR};
use ansi_term::ANSIStrings; use ansi_term::ANSIStrings;
use zellij_tile::prelude::*; use zellij_tile::prelude::*;
use zellij_tile_extra::*;
pub fn active_tab(text: String, palette: Palette) -> LinePart { pub fn active_tab(text: String, palette: Palette) -> LinePart {
let left_separator = style!(palette.bg, palette.green).paint(ARROW_SEPARATOR); let left_separator = style!(palette.bg, palette.green).paint(ARROW_SEPARATOR);

View file

@ -0,0 +1,12 @@
[package]
name = "zellij-tile-extra"
version = "1.0.0"
authors = ["denis <denismaximov98@gmail.com>"]
edition = "2018"
description = "A utility library for Zellij plugins"
license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ansi_term = "0.12.1"

View file

@ -0,0 +1 @@
../LICENSE.md

View file

@ -0,0 +1,15 @@
#[macro_export]
macro_rules! rgb {
($a:expr) => {
ansi_term::Color::RGB($a.0, $a.1, $a.2)
};
}
#[macro_export]
macro_rules! style {
($a:expr, $b:expr) => {
ansi_term::Style::new()
.fg(ansi_term::Color::RGB($a.0, $a.1, $a.2))
.on(ansi_term::Color::RGB($b.0, $b.1, $b.2))
};
}

View file

@ -39,19 +39,3 @@ macro_rules! register_plugin {
} }
}; };
} }
#[macro_export]
macro_rules! rgb {
($a:expr) => {
ansi_term::Color::RGB($a.0, $a.1, $a.2)
};
}
#[macro_export]
macro_rules! style {
($a:expr, $b:expr) => {
ansi_term::Style::new()
.fg(ansi_term::Color::RGB($a.0, $a.1, $a.2))
.on(ansi_term::Color::RGB($b.0, $b.1, $b.2))
};
}