summaryrefslogtreecommitdiff
path: root/src/driver.rs
diff options
context:
space:
mode:
authorNick Gerace <nickagerace@gmail.com>2021-05-23 00:39:16 -0400
committerNick Gerace <nickagerace@gmail.com>2021-05-23 00:47:29 -0400
commitc5208fa5d01624bdf794ee7f9f70bd62fe4f3968 (patch)
treec579850725a458b2a25dfddeff7f08b95e032c68 /src/driver.rs
parent7ae35379eab6768a6cdd11b4ed6ba22e00d8ed44 (diff)
downloadgfold-c5208fa5d01624bdf794ee7f9f70bd62fe4f3968.zip
Bold table headers instead of repo names
Diffstat (limited to 'src/driver.rs')
-rw-r--r--src/driver.rs20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/driver.rs b/src/driver.rs
index c92599b..ee47919 100644
--- a/src/driver.rs
+++ b/src/driver.rs
@@ -1,7 +1,8 @@
//! This module contains the types required for generating results for `gfold`.
use crate::{driver_internal::TableWrapper, util};
+use ansi_term::Style;
use anyhow::Result;
-use log::{debug, warn};
+use log::{debug, error, warn};
use std::{
cmp::Ordering,
fs,
@@ -43,12 +44,27 @@ impl Driver {
/// Print results to `STDOUT` after generation.
pub fn print_results(self) {
+ #[cfg(windows)]
+ ansi_term::enable_ansi_support();
+
debug!("Printing results with {} tables...", self.0.len());
match self.0.len().cmp(&1) {
Ordering::Greater => {
+ let last = match self.0.last() {
+ Some(s) => s.path_string.clone(),
+ None => {
+ error!(
+ "Last object not found for table vector. Continuing with empty string."
+ );
+ String::from("")
+ }
+ };
for table_wrapper in self.0 {
- println!("\n{}", table_wrapper.path_string);
+ println!("{}", Style::new().bold().paint(&table_wrapper.path_string));
table_wrapper.table.printstd();
+ if table_wrapper.path_string != last {
+ println!();
+ }
}
}
Ordering::Equal => {