Skip to content

Commit

Permalink
don't allow certain examples to compile without their features
Browse files Browse the repository at this point in the history
  • Loading branch information
fdncred committed Nov 5, 2023
1 parent 60b3b62 commit a3441ec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion examples/cwd_aware_hinter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
7 changes: 0 additions & 7 deletions examples/external_printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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
Expand Down Expand Up @@ -59,8 +57,3 @@ fn main() {
break;
}
}

#[cfg(not(feature = "external_printer"))]
fn main() {
println!("Please enable the feature: ‘external_printer‘")
}

0 comments on commit a3441ec

Please sign in to comment.