Skip to content

Commit

Permalink
Regex is required for colored help
Browse files Browse the repository at this point in the history
  • Loading branch information
riquito committed Feb 25, 2024
1 parent 353921f commit d3ad493
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/help.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{borrow::Cow, io::IsTerminal};

#[cfg(feature = "regex")]
use regex::Regex;

const HELP: &str = concat!(
Expand Down Expand Up @@ -196,15 +197,15 @@ fn can_use_color() -> bool {
}

pub fn get_help() -> Cow<'static, str> {
if can_use_color() {
if cfg!(feature = "regex") && can_use_color() {
Cow::Owned(get_colored_help(HELP))
} else {
Cow::Borrowed(HELP)
}
}

pub fn get_short_help() -> Cow<'static, str> {
if can_use_color() {
if cfg!(feature = "regex") && can_use_color() {
Cow::Owned(get_colored_short_help(SHORT_HELP))
} else {
Cow::Borrowed(SHORT_HELP)
Expand Down

0 comments on commit d3ad493

Please sign in to comment.