refactor: Re-export ego-tree dependency from linutil core (#811)

* refactor: Export ego-tree from linutil core, rather than workspace

* refactor: Improve code formatting

---------

Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
Liam 2024-11-07 13:00:34 -06:00 committed by GitHub
parent 421044f43e
commit 980365f7c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 12 additions and 22 deletions

5
Cargo.lock generated
View File

@ -250,9 +250,9 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]] [[package]]
name = "ego-tree" name = "ego-tree"
version = "0.6.3" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12a0bb14ac04a9fcf170d0bbbef949b44cc492f4452bd20c095636956f653642" checksum = "7c6ba7d4eec39eaa9ab24d44a0e73a7949a1095a8b3f3abb11eddf27dbb56a53"
[[package]] [[package]]
name = "either" name = "either"
@ -435,7 +435,6 @@ dependencies = [
"ansi-to-tui", "ansi-to-tui",
"anstyle", "anstyle",
"clap", "clap",
"ego-tree",
"linutil_core", "linutil_core",
"oneshot", "oneshot",
"portable-pty", "portable-pty",

View File

@ -3,9 +3,6 @@ license = "MIT"
version = "24.9.28" version = "24.9.28"
edition = "2021" edition = "2021"
[workspace.dependencies]
ego-tree = "0.6.2"
[workspace] [workspace]
members = ["tui", "core", "xtask"] members = ["tui", "core", "xtask"]
default-members = ["tui", "core"] default-members = ["tui", "core"]

View File

@ -5,11 +5,7 @@ repository = "https://github.com/ChrisTitusTech/linutil/tree/main/core"
edition = "2021" edition = "2021"
version.workspace = true version.workspace = true
license.workspace = true license.workspace = true
include = [ include = ["src/*.rs", "Cargo.toml", "tabs/**"]
"src/*.rs",
"Cargo.toml",
"tabs/**",
]
[dependencies] [dependencies]
include_dir = "0.7.4" include_dir = "0.7.4"
@ -17,4 +13,4 @@ temp-dir = "0.1.14"
serde = { version = "1.0.205", features = ["derive"], default-features = false } serde = { version = "1.0.205", features = ["derive"], default-features = false }
toml = { version = "0.8.19", features = ["parse"], default-features = false } toml = { version = "0.8.19", features = ["parse"], default-features = false }
which = "6.0.3" which = "6.0.3"
ego-tree = { workspace = true } ego-tree = "0.9.0"

View File

@ -2,6 +2,7 @@ mod inner;
use std::rc::Rc; use std::rc::Rc;
pub use ego_tree;
use ego_tree::Tree; use ego_tree::Tree;
use std::path::PathBuf; use std::path::PathBuf;

View File

@ -15,7 +15,6 @@ tips = ["rand"]
[dependencies] [dependencies]
clap = { version = "4.5.20", features = ["derive"] } clap = { version = "4.5.20", features = ["derive"] }
ego-tree = { workspace = true }
oneshot = "0.1.8" oneshot = "0.1.8"
portable-pty = "0.8.1" portable-pty = "0.8.1"
ratatui = "0.29.0" ratatui = "0.29.0"

View File

@ -1,6 +1,5 @@
use crate::{state::ListEntry, theme::Theme}; use crate::{state::ListEntry, theme::Theme};
use ego_tree::NodeId; use linutil_core::{ego_tree::NodeId, Tab};
use linutil_core::Tab;
use ratatui::{ use ratatui::{
crossterm::event::{KeyCode, KeyEvent, KeyModifiers}, crossterm::event::{KeyCode, KeyEvent, KeyModifiers},
layout::{Position, Rect}, layout::{Position, Rect},

View File

@ -71,8 +71,8 @@ impl Shortcut {
} }
fn to_spans(&self) -> Vec<Span<'static>> { fn to_spans(&self) -> Vec<Span<'static>> {
let mut ret: Vec<_> = self let description = Span::styled(self.desc, Style::default().italic());
.key_sequences self.key_sequences
.iter() .iter()
.flat_map(|seq| { .flat_map(|seq| {
[ [
@ -81,8 +81,7 @@ impl Shortcut {
Span::default().content("] "), Span::default().content("] "),
] ]
}) })
.collect(); .chain(std::iter::once(description))
ret.push(Span::styled(self.desc, Style::default().italic())); .collect()
ret
} }
} }

View File

@ -7,8 +7,8 @@ use crate::{
running_command::RunningCommand, running_command::RunningCommand,
theme::Theme, theme::Theme,
}; };
use ego_tree::NodeId;
use linutil_core::{ListNode, TabList}; use linutil_core::{ego_tree::NodeId, ListNode, TabList};
#[cfg(feature = "tips")] #[cfg(feature = "tips")]
use rand::Rng; use rand::Rng;
use ratatui::{ use ratatui::{