refactor: remove unused parameters and simplify build functions
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
ecc6646c6c
commit
a25e6bfdb3
@@ -3,7 +3,7 @@ use is_terminal::IsTerminal;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
|
|
||||||
use crate::compression_engine::default_type;
|
use crate::compression_engine;
|
||||||
use crate::compression_engine::program::CompressionEngineProgram;
|
use crate::compression_engine::program::CompressionEngineProgram;
|
||||||
use crate::compression_engine::CompressionType;
|
use crate::compression_engine::CompressionType;
|
||||||
use crate::compression_engine::COMPRESSION_PROGRAMS;
|
use crate::compression_engine::COMPRESSION_PROGRAMS;
|
||||||
@@ -51,7 +51,7 @@ fn build_path_table(data_path: PathBuf, db_path: PathBuf) -> Table {
|
|||||||
path_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();
|
let mut compression_table = Table::new();
|
||||||
if std::io::stdout().is_terminal() {
|
if std::io::stdout().is_terminal() {
|
||||||
compression_table.set_format(*FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR);
|
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->"Compress",
|
||||||
b->"Decompress"));
|
b->"Decompress"));
|
||||||
|
|
||||||
|
let default_type = compression_engine::default_type();
|
||||||
|
|
||||||
for compression_type in CompressionType::iter() {
|
for compression_type in CompressionType::iter() {
|
||||||
let compression_program: CompressionEngineProgram =
|
let compression_program: CompressionEngineProgram =
|
||||||
match &COMPRESSION_PROGRAMS[compression_type.clone()] {
|
match &COMPRESSION_PROGRAMS[compression_type.clone()] {
|
||||||
@@ -107,20 +109,16 @@ fn build_compression_table(_args: crate::Args, default_type: CompressionType) ->
|
|||||||
|
|
||||||
pub fn mode_status(
|
pub fn mode_status(
|
||||||
_cmd: &mut Command,
|
_cmd: &mut Command,
|
||||||
args: crate::Args,
|
_args: crate::Args,
|
||||||
data_path: PathBuf,
|
data_path: PathBuf,
|
||||||
db_path: PathBuf,
|
db_path: PathBuf,
|
||||||
) -> Result<(), anyhow::Error> {
|
) -> 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:");
|
println!("PATHS:");
|
||||||
path_table.printstd();
|
build_path_table(data_path, db_path)
|
||||||
|
.printstd();
|
||||||
println!();
|
println!();
|
||||||
println!("COMPRESSION:");
|
println!("COMPRESSION:");
|
||||||
compression_table.printstd();
|
build_compression_table()
|
||||||
|
.printstd();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user