refactor: remove unused parameters and simplify build functions

This commit is contained in:
Andrew Phillips
2025-05-13 16:38:22 -03:00
committed by Andrew Phillips (aider)
parent ecc6646c6c
commit a25e6bfdb3

View File

@@ -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(())
}