feat: add compression and digest support with database schema updates
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
9b61a37036
commit
bbdfe19836
@@ -4,9 +4,9 @@ use std::path::PathBuf;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use crate::compression_engine;
|
||||
use crate::compression_engine::program::CompressionEngineProgram;
|
||||
use crate::compression_engine::CompressionType;
|
||||
use crate::compression_engine::COMPRESSION_PROGRAMS;
|
||||
use crate::compression_engine::CompressionType;
|
||||
use crate::compression_engine::program::CompressionEngineProgram;
|
||||
|
||||
use crate::FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR;
|
||||
use crate::FORMAT_NO_BORDER_LINE_SEPARATOR;
|
||||
@@ -68,7 +68,7 @@ fn build_compression_table() -> Table {
|
||||
b->"Decompress"));
|
||||
|
||||
let default_type = compression_engine::default_compression_type();
|
||||
|
||||
|
||||
for compression_type in CompressionType::iter() {
|
||||
let compression_program: CompressionEngineProgram =
|
||||
match &COMPRESSION_PROGRAMS[compression_type.clone()] {
|
||||
@@ -109,9 +109,9 @@ fn build_compression_table() -> Table {
|
||||
|
||||
fn build_digest_table() -> Table {
|
||||
use crate::digest_engine;
|
||||
use crate::digest_engine::program::DigestEngineProgram;
|
||||
use crate::digest_engine::DigestType;
|
||||
use crate::digest_engine::DIGEST_PROGRAMS;
|
||||
use crate::digest_engine::DigestType;
|
||||
use crate::digest_engine::program::DigestEngineProgram;
|
||||
|
||||
let mut digest_table = Table::new();
|
||||
if std::io::stdout().is_terminal() {
|
||||
@@ -128,17 +128,16 @@ fn build_digest_table() -> Table {
|
||||
b->"Args"));
|
||||
|
||||
let default_type = digest_engine::default_digest_type();
|
||||
|
||||
|
||||
for digest_type in DigestType::iter() {
|
||||
let digest_program: DigestEngineProgram =
|
||||
match &DIGEST_PROGRAMS[digest_type.clone()] {
|
||||
Some(digest_program) => digest_program.clone(),
|
||||
None => DigestEngineProgram {
|
||||
program: "".to_string(),
|
||||
args: Vec::new(),
|
||||
supported: true,
|
||||
},
|
||||
};
|
||||
let digest_program: DigestEngineProgram = match &DIGEST_PROGRAMS[digest_type.clone()] {
|
||||
Some(digest_program) => digest_program.clone(),
|
||||
None => DigestEngineProgram {
|
||||
program: "".to_string(),
|
||||
args: Vec::new(),
|
||||
supported: true,
|
||||
},
|
||||
};
|
||||
|
||||
let is_default = digest_type == default_type;
|
||||
|
||||
@@ -172,15 +171,12 @@ pub fn mode_status(
|
||||
db_path: PathBuf,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
println!("PATHS:");
|
||||
build_path_table(data_path, db_path)
|
||||
.printstd();
|
||||
build_path_table(data_path, db_path).printstd();
|
||||
println!();
|
||||
println!("COMPRESSION:");
|
||||
build_compression_table()
|
||||
.printstd();
|
||||
build_compression_table().printstd();
|
||||
println!();
|
||||
println!("DIGEST:");
|
||||
build_digest_table()
|
||||
.printstd();
|
||||
build_digest_table().printstd();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user