From 675f4f9f397d4f1c6429676a3acf6f2abd579c5a Mon Sep 17 00:00:00 2001 From: Boshen Date: Thu, 22 Feb 2024 15:50:52 +0800 Subject: [PATCH] add `fancy-base` for the `actualy` fancy feature --- Cargo.toml | 6 +++++- src/eyreish/mod.rs | 8 ++++---- src/handlers/mod.rs | 8 ++++---- src/lib.rs | 6 +++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3487e01..e8c076f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,12 +48,16 @@ strip-ansi-escapes = "0.2.0" default = ["derive"] derive = ["miette-derive"] no-format-args-capture = [] +fancy-base = [] fancy-no-syscall = [ + "fancy-base", "owo-colors", "textwrap", ] fancy-no-backtrace = [ - "fancy-no-syscall", + "fancy-base", + "owo-colors", + "textwrap", "terminal_size", "supports-hyperlinks", "supports-color", diff --git a/src/eyreish/mod.rs b/src/eyreish/mod.rs index 169df13..544c240 100644 --- a/src/eyreish/mod.rs +++ b/src/eyreish/mod.rs @@ -24,10 +24,10 @@ pub use ReportHandler as EyreContext; #[allow(unreachable_pub)] pub use WrapErr as Context; -#[cfg(not(feature = "fancy-no-syscall"))] +#[cfg(not(feature = "fancy-base"))] use crate::DebugReportHandler; use crate::Diagnostic; -#[cfg(feature = "fancy-no-syscall")] +#[cfg(feature = "fancy-base")] use crate::MietteHandler; use error::ErrorImpl; @@ -102,9 +102,9 @@ fn capture_handler(error: &(dyn Diagnostic + 'static)) -> Box } fn get_default_printer(_err: &(dyn Diagnostic + 'static)) -> Box { - #[cfg(feature = "fancy-no-syscall")] + #[cfg(feature = "fancy-base")] return Box::new(MietteHandler::new()); - #[cfg(not(feature = "fancy-no-syscall"))] + #[cfg(not(feature = "fancy-base"))] return Box::new(DebugReportHandler::new()); } diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 169958a..ecc7b15 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -5,20 +5,20 @@ Reporters included with `miette`. #[allow(unreachable_pub)] pub use debug::*; #[allow(unreachable_pub)] -#[cfg(feature = "fancy-no-syscall")] +#[cfg(feature = "fancy-base")] pub use graphical::*; #[allow(unreachable_pub)] pub use json::*; #[allow(unreachable_pub)] pub use narratable::*; #[allow(unreachable_pub)] -#[cfg(feature = "fancy-no-syscall")] +#[cfg(feature = "fancy-base")] pub use theme::*; mod debug; -#[cfg(feature = "fancy-no-syscall")] +#[cfg(feature = "fancy-base")] mod graphical; mod json; mod narratable; -#[cfg(feature = "fancy-no-syscall")] +#[cfg(feature = "fancy-base")] mod theme; diff --git a/src/lib.rs b/src/lib.rs index 31a900f..90d4653 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -760,7 +760,7 @@ pub use miette_derive::*; pub use error::*; pub use eyreish::*; -#[cfg(feature = "fancy-no-syscall")] +#[cfg(feature = "fancy-base")] pub use handler::*; pub use handlers::*; pub use miette_diagnostic::*; @@ -773,10 +773,10 @@ mod chain; mod diagnostic_chain; mod error; mod eyreish; -#[cfg(feature = "fancy-no-syscall")] +#[cfg(feature = "fancy-base")] mod handler; mod handlers; -#[cfg(feature = "fancy-no-syscall")] +#[cfg(feature = "fancy-base")] pub mod highlighters; #[doc(hidden)] pub mod macro_helpers;