Add imag-diagnostics --more output switch

For more output, which is right now: List unverified entries.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-06-30 19:38:50 +02:00
parent f1ad450033
commit b5d439cef7
2 changed files with 19 additions and 4 deletions

View file

@ -126,8 +126,9 @@ fn main() {
"Print diagnostics about imag and the imag store", "Print diagnostics about imag and the imag store",
ui::build_ui); ui::build_ui);
let template = get_config(&rt, "rt.progressbar_style"); let template = get_config(&rt, "rt.progressbar_style");
let tick_chars = get_config(&rt, "rt.progressticker_chars"); let tick_chars = get_config(&rt, "rt.progressticker_chars");
let verbose = rt.cli().is_present("more-output");
let style = if let Some(tick_chars) = tick_chars { let style = if let Some(tick_chars) = tick_chars {
ProgressStyle::default_spinner().tick_chars(&tick_chars) ProgressStyle::default_spinner().tick_chars(&tick_chars)
@ -176,6 +177,7 @@ fn main() {
let mut max_overall_byte_size : Option<(usize, StoreId)> = None; let mut max_overall_byte_size : Option<(usize, StoreId)> = None;
let mut verified_count = 0; let mut verified_count = 0;
let mut unverified_count = 0; let mut unverified_count = 0;
let mut unverified_entries = vec![];
let mut num_links = 0; let mut num_links = 0;
let mut max_links : Option<(usize, StoreId)> = None; let mut max_links : Option<(usize, StoreId)> = None;
@ -197,6 +199,9 @@ fn main() {
verified_count += 1; verified_count += 1;
} else { } else {
unverified_count += 1; unverified_count += 1;
if verbose {
unverified_entries.push(diag.id.clone());
}
} }
num_links += diag.num_links; num_links += diag.num_links;
@ -239,6 +244,11 @@ fn main() {
} }
do_write!(out, "{} verified entries", verified_count); do_write!(out, "{} verified entries", verified_count);
do_write!(out, "{} unverified entries", unverified_count); do_write!(out, "{} unverified entries", unverified_count);
if verbose {
for unve in unverified_entries.iter() {
do_write!(out, "Unverified: {}", unve);
}
}
} }
} }

View file

@ -17,9 +17,14 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// //
use clap::App; use clap::{Arg, App};
pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
app app.arg(Arg::with_name("more-output")
.long("more")
.takes_value(false)
.required(false)
.multiple(false)
.help("Show more output."))
} }