From be96551501d4db0324ee937aa827e7663ecaa532 Mon Sep 17 00:00:00 2001 From: o2sh Date: Mon, 12 Oct 2020 14:52:53 +0200 Subject: [PATCH] simplify no_bold logic --- src/onefetch/cli.rs | 2 +- src/onefetch/info.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/onefetch/cli.rs b/src/onefetch/cli.rs index 35c12fe44..db2929450 100644 --- a/src/onefetch/cli.rs +++ b/src/onefetch/cli.rs @@ -180,7 +180,7 @@ impl Options { Vec::new() }, disabled_fields: info_fields::get_disabled_fields(fields_to_hide)?, - no_bold: !matches.is_present("no-bold"), + no_bold: matches.is_present("no-bold"), image, image_backend, no_merges: matches.is_present("no-merge-commits"), diff --git a/src/onefetch/info.rs b/src/onefetch/info.rs index 3ffa5ae16..bb1883118 100644 --- a/src/onefetch/info.rs +++ b/src/onefetch/info.rs @@ -275,7 +275,7 @@ impl std::fmt::Display for Info { } } else { let mut logo_lines = - AsciiArt::new(self.get_ascii(), self.colors(), self.config.no_bold); + AsciiArt::new(self.get_ascii(), self.colors(), !self.config.no_bold); loop { match (logo_lines.next(), info_lines.next()) { (Some(logo_line), Some(info_line)) => { @@ -780,11 +780,12 @@ impl Info { /// Returns a formatted info label with the desired color and boldness fn get_formatted_info_label(&self, label: &str, color: Color) -> ColoredString { - let mut formatted_label = label.color(color); + let formatted_label = label.color(color); if self.config.no_bold { - formatted_label = formatted_label.bold(); + formatted_label + } else { + formatted_label.bold() } - formatted_label } }