From b5d439cef7677d8beb31e20b886728305e0c4b20 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 30 Jun 2019 19:38:50 +0200 Subject: [PATCH] Add imag-diagnostics --more output switch For more output, which is right now: List unverified entries. Signed-off-by: Matthias Beyer --- bin/core/imag-diagnostics/src/main.rs | 14 ++++++++++++-- bin/core/imag-diagnostics/src/ui.rs | 9 +++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/core/imag-diagnostics/src/main.rs b/bin/core/imag-diagnostics/src/main.rs index 5a69c7a5..bef0b152 100644 --- a/bin/core/imag-diagnostics/src/main.rs +++ b/bin/core/imag-diagnostics/src/main.rs @@ -126,8 +126,9 @@ fn main() { "Print diagnostics about imag and the imag store", ui::build_ui); - let template = get_config(&rt, "rt.progressbar_style"); - let tick_chars = get_config(&rt, "rt.progressticker_chars"); + let template = get_config(&rt, "rt.progressbar_style"); + 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 { 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 verified_count = 0; let mut unverified_count = 0; + let mut unverified_entries = vec![]; let mut num_links = 0; let mut max_links : Option<(usize, StoreId)> = None; @@ -197,6 +199,9 @@ fn main() { verified_count += 1; } else { unverified_count += 1; + if verbose { + unverified_entries.push(diag.id.clone()); + } } num_links += diag.num_links; @@ -239,6 +244,11 @@ fn main() { } do_write!(out, "{} verified entries", verified_count); do_write!(out, "{} unverified entries", unverified_count); + if verbose { + for unve in unverified_entries.iter() { + do_write!(out, "Unverified: {}", unve); + } + } } } diff --git a/bin/core/imag-diagnostics/src/ui.rs b/bin/core/imag-diagnostics/src/ui.rs index f0faad30..9e0c3e66 100644 --- a/bin/core/imag-diagnostics/src/ui.rs +++ b/bin/core/imag-diagnostics/src/ui.rs @@ -17,9 +17,14 @@ // 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> { - app + app.arg(Arg::with_name("more-output") + .long("more") + .takes_value(false) + .required(false) + .multiple(false) + .help("Show more output.")) }