cache stdout handle
This commit is contained in:
parent
64e877d4a6
commit
83b93866f2
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
/target
|
||||
/flamegraph.svg
|
||||
/perf.data*
|
||||
|
|
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -413,6 +413,7 @@ dependencies = [
|
|||
"prettytable-rs",
|
||||
"readfilez",
|
||||
"string_cache",
|
||||
"term",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
|
|
@ -13,3 +13,7 @@ readfilez = "0.2"
|
|||
string_cache = "0.8"
|
||||
thiserror = "1.0"
|
||||
prettytable = { version = "0.8", package = "prettytable-rs" }
|
||||
term = "0.5"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
|
15
src/main.rs
15
src/main.rs
|
@ -13,7 +13,10 @@ fn main() {
|
|||
use chrono::Datelike;
|
||||
use encoding::types::Encoding;
|
||||
use prettytable::{cell, format, row, Table};
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::{
|
||||
collections::{BTreeMap, HashSet},
|
||||
io::Write,
|
||||
};
|
||||
|
||||
let mut highlight = HashSet::new();
|
||||
|
||||
|
@ -26,8 +29,10 @@ fn main() {
|
|||
highlight.remove(";");
|
||||
}
|
||||
|
||||
let mut stdout = term::stdout().unwrap();
|
||||
|
||||
for i in args {
|
||||
println!("F = {}", i);
|
||||
writeln!(&mut stdout, "F = {}", i).unwrap();
|
||||
|
||||
let fh = readfilez::read_from_file(std::fs::File::open(i)).expect("unable to open file");
|
||||
|
||||
|
@ -107,7 +112,7 @@ fn main() {
|
|||
ent.1 += i.umsatz;
|
||||
}
|
||||
|
||||
println!("skipped {} entries", i_skipped);
|
||||
writeln!(&mut stdout, "skipped {} entries", i_skipped).unwrap();
|
||||
|
||||
if accu.is_empty() {
|
||||
continue;
|
||||
|
@ -152,6 +157,8 @@ fn main() {
|
|||
});
|
||||
}
|
||||
|
||||
table.printstd();
|
||||
table
|
||||
.print_term(&mut *stdout)
|
||||
.expect("unable to print table");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue