diff --git a/src/compression_engine/program.rs b/src/compression_engine/program.rs index d97383f..a447e24 100644 --- a/src/compression_engine/program.rs +++ b/src/compression_engine/program.rs @@ -5,8 +5,8 @@ use std::fs; use std::fs::File; use std::io::{Read, Write}; use std::os::unix::fs::PermissionsExt; -use std::process::{Command, Stdio}; use std::path::PathBuf; +use std::process::{Command, Stdio}; use crate::compression_engine::CompressionEngine; diff --git a/src/digest_engine/program.rs b/src/digest_engine/program.rs index 0d1f50b..462daf6 100644 --- a/src/digest_engine/program.rs +++ b/src/digest_engine/program.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{anyhow, Result, Context}; use log::*; use std::env; use std::fs; @@ -51,7 +51,7 @@ impl DigestEngine for DigestEngineProgram { .stdin(Stdio::piped()) .stdout(Stdio::piped()) .spawn() - .with_context(|| anyhow!( + .context(anyhow!( "Problem spawning child process: {:?} {:?}", program, args diff --git a/src/main.rs b/src/main.rs index 51fb623..ba1e7a9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,9 +20,9 @@ extern crate lazy_static; pub mod compression_engine; pub mod db; +pub mod digest_engine; //pub mod item; - extern crate term; lazy_static! { @@ -105,17 +105,13 @@ struct ItemArgs { #[arg(help("Set metadata for the item using the format KEY=[VALUE], the metadata will be removed if VALUE is not provided"))] meta: Vec, - #[arg(help_heading("Item Options"), short, long, env("KEEP_DIGEST"))] + #[arg(help_heading("Item Options"), long, env("KEEP_DIGEST"))] #[arg(help("Digest algorithm to use when saving items"))] digest: Option, #[arg(help_heading("Item Options"), short, long, env("KEEP_COMPRESSION"))] #[arg(help("Compression algorithm to use when saving items"))] compression: Option, - - #[arg(help_heading("Item Options"), short, long, env("KEEP_DIGEST"))] - #[arg(help("Digest algorithm to use when saving items"))] - digest: Option, } #[derive(Parser, Debug)] diff --git a/src/modes/update.rs b/src/modes/update.rs index 0026682..1ed844e 100644 --- a/src/modes/update.rs +++ b/src/modes/update.rs @@ -2,8 +2,8 @@ use anyhow::Result; use std::path::PathBuf; use std::str::FromStr; -use crate::db; use crate::compression_engine::CompressionType; +use crate::db; use clap::error::ErrorKind; use clap::Command; use log::{debug, info}; diff --git a/src/tests.rs b/src/tests.rs index 1ba732d..794afcb 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -57,37 +57,6 @@ mod tests { cmd, output.status ); - - // Test with digest option - let cmd = format!("echo {} | {} --digest sha256 -c none none", INPUT_A, env); - println!("RUNNING: {}", cmd); - let output = run_sh(cmd.as_str()); - assert!( - output.status.success(), - "Command failed: {} {}", - cmd, - output.status - ); - - let cmd = format!("echo {} | {} --digest md5 -c none none", INPUT_A, env); - println!("RUNNING: {}", cmd); - let output = run_sh(cmd.as_str()); - assert!( - output.status.success(), - "Command failed: {} {}", - cmd, - output.status - ); - - let cmd = format!("echo {} | {} --digest program -p md5sum -c none none", INPUT_A, env); - println!("RUNNING: {}", cmd); - let output = run_sh(cmd.as_str()); - assert!( - output.status.success(), - "Command failed: {} {}", - cmd, - output.status - ); } // Helper function to check if a file exists in the data directory