From a25e6bfdb3932a9339c3d4f2db217e63c9abaf39 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Tue, 13 May 2025 16:38:22 -0300 Subject: [PATCH] refactor: remove unused parameters and simplify build functions --- src/modes/status.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/modes/status.rs b/src/modes/status.rs index c6d96db..89085c9 100644 --- a/src/modes/status.rs +++ b/src/modes/status.rs @@ -3,7 +3,7 @@ use is_terminal::IsTerminal; use std::path::PathBuf; use strum::IntoEnumIterator; -use crate::compression_engine::default_type; +use crate::compression_engine; use crate::compression_engine::program::CompressionEngineProgram; use crate::compression_engine::CompressionType; use crate::compression_engine::COMPRESSION_PROGRAMS; @@ -51,7 +51,7 @@ fn build_path_table(data_path: PathBuf, db_path: PathBuf) -> Table { path_table } -fn build_compression_table(_args: crate::Args, default_type: CompressionType) -> Table { +fn build_compression_table() -> Table { let mut compression_table = Table::new(); if std::io::stdout().is_terminal() { compression_table.set_format(*FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR); @@ -67,6 +67,8 @@ fn build_compression_table(_args: crate::Args, default_type: CompressionType) -> b->"Compress", b->"Decompress")); + let default_type = compression_engine::default_type(); + for compression_type in CompressionType::iter() { let compression_program: CompressionEngineProgram = match &COMPRESSION_PROGRAMS[compression_type.clone()] { @@ -107,20 +109,16 @@ fn build_compression_table(_args: crate::Args, default_type: CompressionType) -> pub fn mode_status( _cmd: &mut Command, - args: crate::Args, + _args: crate::Args, data_path: PathBuf, db_path: PathBuf, ) -> Result<(), anyhow::Error> { - let mut path_table = Table::new(); - - let compression_table = build_compression_table(args, default_type()); - let path_table = build_path_table(data_path, db_path); - println!("PATHS:"); - path_table.printstd(); + build_path_table(data_path, db_path) + .printstd(); println!(); println!("COMPRESSION:"); - compression_table.printstd(); - + build_compression_table() + .printstd(); Ok(()) }