diff --git a/.github/workflows/build_examples.yml b/.github/workflows/build_examples.yml index 5bd4b06..12fb06c 100644 --- a/.github/workflows/build_examples.yml +++ b/.github/workflows/build_examples.yml @@ -14,13 +14,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Build examples with tui and crossterm + - name: Build examples with ratatui and termion run: cargo build --examples - - name: Build examples with tui and termion - run: cargo build --examples --no-default-features -F examples-tui-termion - - name: Build examples with tui and crossterm - run: cargo build --examples --no-default-features -F examples-tui-crossterm - - name: Build example with ratatui and termion - run: cargo build --examples --no-default-features -F ratatui-support,examples-ratatui-termion - name: Build example with ratatui and crossterm - run: cargo build --examples --no-default-features -F ratatui-support,examples-ratatui-crossterm + run: cargo build --examples --no-default-features -F examples-ratatui-crossterm diff --git a/Cargo.toml b/Cargo.toml index 974a453..1292f43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.9.6" authors = ["Jochen Kiemes "] edition = "2021" license = "MIT" -description = "Logger with smart widget for the `tui` crate" +description = "Logger with smart widget for the `ratatui` crate" documentation = "https://docs.rs/tui-logger/latest/tui_logger/" repository = "https://github.com/gin66/tui-logger" readme = "README.md" @@ -16,8 +16,7 @@ travis-ci = { repository = "gin66/tui-logger" } [dependencies] log = "0.4" chrono = { version = "0.4", default-features = false, features = ["clock"] } -tui = { version = "0.19", default-features = false, package = "tui", optional = true } -ratatui = { version = "0.23.0", default-features = false, package = "ratatui", optional = true } +ratatui = { version = "0.24.0", default-features = false, package = "ratatui" } tracing = {version = "0.1.37", optional = true} tracing-subscriber = {version = "0.3", optional = true} lazy_static = "1.0" @@ -25,7 +24,7 @@ fxhash = "0.2" parking_lot = "0.12" slog = { version = "2.7.0", optional = true } -# Optional features for demo. Unfortunately cannot move to dep-dependencies +# Optional features for demo. Unfortunately cannot move to dev-dependencies termion = {version = "1.5", optional = true } crossterm = {version = "0.27", optional = true } @@ -33,14 +32,10 @@ crossterm = {version = "0.27", optional = true } env_logger = "0.10.0" [features] -default = ["tui","tui/termion", "examples-tui-termion"] -tui-rs = ["tui"] +default = ["ratatui/termion", "examples-ratatui-termion"] slog-support = ["slog"] -ratatui-support = ["ratatui"] tracing-support = ["tracing", "tracing-subscriber"] # This features are exclusively used by examples/demo.rs -examples-tui-termion = ["termion", "tui/termion"] -examples-tui-crossterm = ["crossterm", "tui/crossterm"] examples-ratatui-termion = ["termion", "ratatui/termion"] examples-ratatui-crossterm = ["crossterm", "ratatui/crossterm"] diff --git a/README.md b/README.md index 8bfb165..632eac1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - # Logger with smart widget for the `tui` and `ratatui` crate + # Logger with smart widget for the `ratatui` crate ![Build Status](https://travis-ci.org/gin66/tui-logger.svg?branch=master) [![dependency status](https://deps.rs/repo/github/gin66/tui-logger/status.svg?service=github&nocache=0_9_1)](https://deps.rs/repo/github/gin66/tui-logger) @@ -152,10 +152,6 @@ Enabled by feature "tracing-support" - ## `ratatui` support - - Enabled by feature "ratatui-support" + disable default-features of tui-logger - ## Custom filtering ```rust #[macro_use] diff --git a/examples/demo.rs b/examples/demo.rs index 0c9cb2b..006db35 100644 --- a/examples/demo.rs +++ b/examples/demo.rs @@ -26,29 +26,9 @@ use termion::{ use ratatui::backend::CrosstermBackend as SelectedBackend; #[cfg(feature = "examples-ratatui-termion")] use ratatui::backend::TermionBackend as SelectedBackend; -#[cfg(feature = "ratatui-support")] use ratatui::prelude::*; -#[cfg(feature = "ratatui-support")] use ratatui::widgets::*; -#[cfg(not(feature = "ratatui-support"))] -use tui::backend::Backend; -#[cfg(feature = "examples-tui-crossterm")] -use tui::backend::CrosstermBackend as SelectedBackend; -#[cfg(feature = "examples-tui-termion")] -use tui::backend::TermionBackend as SelectedBackend; - -#[cfg(not(feature = "ratatui-support"))] -use tui::layout::{Constraint, Direction, Layout, Rect}; -#[cfg(not(feature = "ratatui-support"))] -use tui::style::{Color, Modifier, Style}; -#[cfg(not(feature = "ratatui-support"))] -use tui::widgets::{Block, Borders, Gauge, Tabs}; -#[cfg(not(feature = "ratatui-support"))] -use tui::Frame; -#[cfg(not(feature = "ratatui-support"))] -use tui::Terminal; - use tui_logger::*; struct App { @@ -229,10 +209,7 @@ fn main() -> std::result::Result<(), std::io::Error> { Ok(()) } -fn draw_frame(t: &mut Frame, size: Rect, app: &mut App) { - #[cfg(not(feature = "ratatui-support"))] - let tabs: Vec = vec!["V1".into(), "V2".into(), "V3".into(), "V4".into()]; - #[cfg(feature = "ratatui-support")] +fn draw_frame(t: &mut Frame, size: Rect, app: &mut App) { let tabs: Vec = vec!["V1".into(), "V2".into(), "V3".into(), "V4".into()]; let sel = app.selected_tab; diff --git a/src/lib.rs b/src/lib.rs index da03096..1946de0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -111,31 +111,31 @@ //! //! Run demo with tui and termion: //! -//! ``` +//! ```ignore //! cargo run --example demo --no-default-features -F tui-rs,examples-tui-termion //! ``` //! //! or simply: //! -//! ``` +//! ```ignore //! cargo run --example demo //! ``` //! //! Run demo with tui and crossterm: //! -//! ``` +//! ```ignore //! cargo run --example demo --no-default-features -F tui-rs,examples-tui-crossterm //! ``` //! //! Run demo with ratatui and termion: //! -//! ``` +//! ```ignore //! cargo run --example demo --no-default-features -F ratatui-support,examples-ratatui-termion //! ``` //! //! Run demo with ratatui and crossterm: //! -//! ``` +//! ```ignore //! cargo run --example demo --no-default-features -F ratatui-support,examples-ratatui-crossterm //! ``` //! @@ -213,26 +213,13 @@ use std::io::Write; use std::mem; use std::sync::Arc; -#[cfg(feature = "ratatui-support")] use ratatui::prelude::*; -#[cfg(feature = "ratatui-support")] use ratatui::widgets::*; use chrono::{DateTime, Local}; use log::{Level, LevelFilter, Log, Metadata, Record}; use parking_lot::Mutex; -#[cfg(not(feature = "ratatui-support"))] -use tui::buffer::Buffer; -#[cfg(not(feature = "ratatui-support"))] -use tui::layout::{Constraint, Direction, Layout, Rect}; -#[cfg(not(feature = "ratatui-support"))] -use tui::style::{Modifier, Style}; -#[cfg(not(feature = "ratatui-support"))] -use tui::text::Spans as Line; -#[cfg(not(feature = "ratatui-support"))] -use tui::widgets::{Block, BorderType, Borders, Widget}; - mod circular; #[cfg(feature = "slog-support")] mod slog; @@ -1454,14 +1441,9 @@ impl<'a> Widget for TuiLoggerSmartWidget<'a> { }; let mut title_log = self.title_log.clone(); - #[cfg(feature = "ratatui-support")] title_log .spans .push(format!(" [log={:.1}/s]", entries_s).into()); - #[cfg(not(feature = "ratatui-support"))] - title_log - .0 - .push(format!(" [log={:.1}/s]", entries_s).into()); let hide_target = self.state.lock().hide_target; if hide_target {