added output saved file size #595

This commit is contained in:
DustInDark
2022-06-22 00:13:33 +09:00
parent b4ef082525
commit db5c57c35d

View File

@@ -4,6 +4,7 @@ use crate::detections::print;
use crate::detections::print::{AlertMessage, IS_HIDE_RECORD_ID};
use crate::detections::utils;
use crate::detections::utils::write_color_buffer;
use bytesize::ByteSize;
use chrono::{DateTime, Local, TimeZone, Utc};
use csv::QuoteStyle;
use hashbrown::HashMap;
@@ -17,6 +18,7 @@ use std::fs::File;
use std::io;
use std::io::BufWriter;
use std::io::Write;
use std::fs;
use std::process;
use termcolor::{BufferWriter, Color, ColorChoice, ColorSpec, WriteColor};
use terminal_size::Width;
@@ -358,6 +360,17 @@ fn emit_csv<W: std::io::Write>(
wtr.flush()?;
}
let output_path = configs::CONFIG.read().unwrap().args.output.clone();
if let Some(path) = output_path {
if let Ok(metadata) = fs::metadata(path) {
println!(
"Saved file: {} ({})", configs::CONFIG.read().unwrap().args.output.as_ref().unwrap().display(), ByteSize::b(metadata.len()).to_string_as(false)
);
println!();
}
};
disp_wtr_buf.clear();
disp_wtr_buf.set_color(ColorSpec::new().set_fg(None)).ok();
writeln!(disp_wtr_buf, "Results Summary:").ok();