From 3a80780ee993c562c64c00b22adc8dc604f3fa60 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Sat, 10 May 2025 10:02:48 -0300 Subject: [PATCH] refactor: remove mode_status function --- src/main.rs | 91 ----------------------------------------------------- 1 file changed, 91 deletions(-) diff --git a/src/main.rs b/src/main.rs index da9aef5..98bd8ba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -946,94 +946,3 @@ fn mode_info(cmd: &mut Command, args: Args, ids: &mut Vec, tags: &mut Vec Result<()> { - let mut path_table = Table::new(); - - if std::io::stdout().is_terminal() { - path_table.set_format(*FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR); - } else { - path_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR); - } - - path_table.set_titles(Row::new(vec![ - Cell::new("Type").with_style(Attr::Bold), - Cell::new("Path").with_style(Attr::Bold), - ])); - - path_table.add_row(Row::new(vec![ - Cell::new("Data"), - Cell::new(&data_path.into_os_string().into_string().expect("Unable to convert data path to string")) - ])); - - path_table.add_row(Row::new(vec![ - Cell::new("Database"), - Cell::new(&db_path.into_os_string().into_string().expect("Unable to convert DB path to string")) - ])); - - - let mut compression_table = Table::new(); - if std::io::stdout().is_terminal() { - compression_table.set_format(*FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR); - } else { - compression_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR); - } - - compression_table.set_titles(row!( - b->"Type", - b->"Found", - b->"Default", - b->"Binary", - b->"Compress", - b->"Decompress")); - - - let default_type = match args.item.compression { - Some(compression_name) => CompressionType::from_str(&compression_name) - .context(anyhow!("Invalid compression type {}", compression_name))?, - None => compression::default_type() - }; - - for compression_type in CompressionType::iter() { - let compression_program: CompressionEngineProgram = match &compression::COMPRESSION_PROGRAMS[compression_type.clone()] { - Some(compression_program) => compression_program.clone(), - None => CompressionEngineProgram { - program: "".to_string(), - compress: Vec::new(), - decompress: Vec::new(), - supported: true - } - }; - - let is_default = compression_type == default_type; - - compression_table.add_row(Row::new(vec![ - Cell::new(&compression_type.to_string()), - match compression_program.supported { - true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)), - false => Cell::new("No").with_style(Attr::ForegroundColor(color::RED)) - }, - match is_default { - true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)), - false => Cell::new("No") - }, - match compression_program.program.eq("") { - true => Cell::new("").with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)), - false => Cell::new(&compression_program.program), - }, - Cell::new(&compression_program.compress.join(" ")), - Cell::new(&compression_program.decompress.join(" ")), - ])); - } - - println!("PATHS:"); - path_table.printstd(); - println!(); - println!("COMPRESSION:"); - compression_table.printstd(); - - Ok(()) -} -