From a3441ec289e88ef2af10c30f1390d9999c140f1a Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sun, 5 Nov 2023 12:09:59 -0600 Subject: [PATCH] don't allow certain examples to compile without their features --- Cargo.toml | 8 ++++++++ examples/cwd_aware_hinter.rs | 2 +- examples/external_printer.rs | 7 ------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7fc3fbc3..9d3ed7ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,3 +42,11 @@ external_printer = ["crossbeam"] sqlite = ["rusqlite/bundled", "serde_json"] sqlite-dynlib = ["rusqlite", "serde_json"] system_clipboard = ["clipboard"] + +[[example]] +name = "cwd_aware_hinter" +required-features = ["sqlite"] + +[[example]] +name = "external_printer" +required-features = ["external_printer"] diff --git a/examples/cwd_aware_hinter.rs b/examples/cwd_aware_hinter.rs index d84d24f1..1e3d1010 100644 --- a/examples/cwd_aware_hinter.rs +++ b/examples/cwd_aware_hinter.rs @@ -58,7 +58,7 @@ fn main() -> io::Result<()> { let mut line_editor = Reedline::create() .with_hinter(Box::new( - CwdAwareHinter::default().with_style(Style::new().italic().fg(Color::Yellow)), + CwdAwareHinter::default().with_style(Style::new().bold().italic().fg(Color::Yellow)), )) .with_history(history); diff --git a/examples/external_printer.rs b/examples/external_printer.rs index 350843a9..633a1238 100644 --- a/examples/external_printer.rs +++ b/examples/external_printer.rs @@ -2,7 +2,6 @@ // to run: // cargo run --example external_printer --features=external_printer -#[cfg(feature = "external_printer")] use { reedline::ExternalPrinter, reedline::{DefaultPrompt, Reedline, Signal}, @@ -11,7 +10,6 @@ use { std::time::Duration, }; -#[cfg(feature = "external_printer")] fn main() { let printer = ExternalPrinter::default(); // make a clone to use it in a different thread @@ -59,8 +57,3 @@ fn main() { break; } } - -#[cfg(not(feature = "external_printer"))] -fn main() { - println!("Please enable the feature: ‘external_printer‘") -}