Skip to content

Commit 7904bce

Browse files
authored
fix: quick fix to make the library buildable (#1243)
1 parent 8ef8ef4 commit 7904bce

File tree

2 files changed

+6
-93
lines changed

2 files changed

+6
-93
lines changed

Cargo.lock

Lines changed: 2 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/execution/stats.rs

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
use crate::prelude::*;
2-
use owo_colors::{AnsiColors, OwoColorize};
32

43
use std::{
54
ops::AddAssign,
65
sync::atomic::{AtomicI64, Ordering::Relaxed},
76
};
87

9-
/// Check if stdout is a TTY
10-
fn is_stdout_tty() -> bool {
11-
atty::is(atty::Stream::Stdout)
12-
}
13-
148
#[derive(Default, Serialize)]
159
pub struct Counter(pub AtomicI64);
1610

@@ -235,16 +229,7 @@ impl std::fmt::Display for UpdateStats {
235229

236230
// Error handling
237231
if num_errors > 0 {
238-
let tty = is_stdout_tty();
239-
if tty {
240-
write!(
241-
f,
242-
"{}",
243-
format!("{} rows failed", num_errors).color(AnsiColors::White)
244-
)?;
245-
} else {
246-
write!(f, "{} rows failed", num_errors)?;
247-
}
232+
write!(f, "{} rows failed", num_errors)?;
248233
if !segments.is_empty() {
249234
write!(f, "; ")?;
250235
}
@@ -297,19 +282,8 @@ impl std::fmt::Display for UpdateStats {
297282
if remaining_width > 0 {
298283
bar.push_str(&" ".repeat(remaining_width));
299284
}
300-
let tty = is_stdout_tty();
301285
// Use total from current operations - this represents the actual record count
302-
if tty {
303-
write!(
304-
f,
305-
"[{}] {}/{} records ",
306-
bar.color(AnsiColors::BrightBlack),
307-
total - num_in_process,
308-
total
309-
)?;
310-
} else {
311-
write!(f, "[{}] {}/{} records ", bar, total - num_in_process, total)?;
312-
}
286+
write!(f, "[{}] {}/{} records ", bar, total - num_in_process, total)?;
313287

314288
// Add segment labels with different grey shades for each segment type
315289
let mut first = true;
@@ -318,16 +292,7 @@ impl std::fmt::Display for UpdateStats {
318292
if !first {
319293
write!(f, " ")?;
320294
}
321-
if tty {
322-
match *segment_type {
323-
"+" => write!(f, "{}", label.color(AnsiColors::BrightBlack))?, // Lightest grey for additions
324-
"-" => write!(f, "{}", label.color(AnsiColors::White))?, // White for removals
325-
"~" => write!(f, "{}", label.color(AnsiColors::Black))?, // Dark grey for updates
326-
_ => write!(f, "{}", label.color(AnsiColors::Black))?, // Black for no-change
327-
}
328-
} else {
329-
write!(f, "{}", label)?;
330-
}
295+
write!(f, "{}", label)?;
331296
first = false;
332297
}
333298
}
@@ -340,16 +305,7 @@ impl std::fmt::Display for UpdateStats {
340305
if !segments.is_empty() {
341306
write!(f, " ")?;
342307
}
343-
let tty = is_stdout_tty();
344-
if tty {
345-
write!(
346-
f,
347-
"{}",
348-
format!("({} in process)", num_in_process).color(AnsiColors::Black)
349-
)?;
350-
} else {
351-
write!(f, "({} in process)", num_in_process)?;
352-
}
308+
write!(f, "({} in process)", num_in_process)?;
353309
}
354310

355311
Ok(())

0 commit comments

Comments
 (0)