Skip to content

Commit

Permalink
Merge pull request #132 from jayvdb/colored-optional
Browse files Browse the repository at this point in the history
Allow disabling dependency colored
  • Loading branch information
GuyL99 authored Sep 3, 2023
2 parents ef0b633 + 2c12105 commit a04ece8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 0 additions & 2 deletions cherrybomb-engine/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion cherrybomb-oas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["colored"]

[dependencies]
serde_json = "^1.0"
serde = { version = "^1.0", features = ["derive"] }
uuid = { version = "0.8", features = ["v4","serde"] } # legacy
colored = "2.0.0" # legacy
colored = { version = "2.0.0", optional = true } # legacy
11 changes: 11 additions & 0 deletions cherrybomb-oas/src/legacy/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ impl Default for QuePay {
}
impl fmt::Display for QuePay {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[cfg(feature = "colored")]
use colored::*;
#[cfg(feature = "colored")]
match self {
Self::Headers => write!(f, "{:16}", "Headers".bold().truecolor(253, 186, 116)),
Self::Path => write!(f, "{:16}", "Path".bold().truecolor(147, 197, 253)),
Expand All @@ -126,6 +128,15 @@ impl fmt::Display for QuePay {
),
Self::None => write!(f, ""),
}
#[cfg(not(feature = "colored"))]
match self {
Self::Headers => write!(f, "{:16}", "Headers"),
Self::Path => write!(f, "{:16}", "Path"),
Self::Query => write!(f, "{:16}", "Query"),
Self::Payload => write!(f, "{:16}", "Request Payload"),
Self::Response => write!(f, "{:16}", "Response Payload"),
Self::None => write!(f, ""),
}
}
}
// #[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq, Hash)]
Expand Down

0 comments on commit a04ece8

Please sign in to comment.