increase verbosity
This commit is contained in:
parent
bf7d598de7
commit
1e5d0d4680
@ -19,6 +19,7 @@ impl CompareMode {
|
||||
right: String,
|
||||
selection: Option<String>,
|
||||
count_only: Option<bool>,
|
||||
verbose: Option<bool>,
|
||||
) -> CompareMode {
|
||||
let left = import_snapshot(left).unwrap_or_default();
|
||||
let right = import_snapshot(right).unwrap_or_default();
|
||||
@ -112,12 +113,12 @@ mod tests {
|
||||
let right_dir = format!("/home/{}/Documents/", user);
|
||||
println!("{right}");
|
||||
|
||||
let mut n1 = CreateMode::new(left.clone(), "/etc".to_string());
|
||||
let mut n1 = CreateMode::new(left.clone(), "/etc".to_string(), );
|
||||
let _ = n1.run();
|
||||
let mut n2 = CreateMode::new(right.clone(), "/etc".to_string());
|
||||
let mut n2 = CreateMode::new(right.clone(), "/etc".to_string(), );
|
||||
let _ = n2.run();
|
||||
|
||||
let cm = CompareMode::new(left, right, None, None);
|
||||
let cm = CompareMode::new(left, right, None, None, );
|
||||
|
||||
// println!("{:?}", cm);
|
||||
assert!(cm.left.file_hashes.lock().unwrap().len() > 0);
|
||||
|
@ -12,7 +12,7 @@ pub struct CreateMode {
|
||||
}
|
||||
|
||||
impl CreateMode {
|
||||
pub fn new(snapshot_path: String, root_path: String) -> CreateMode {
|
||||
pub fn new(snapshot_path: String, root_path: String, verbose: Option<bool>) -> CreateMode {
|
||||
if snapshot_path.replace("./", "").is_empty() {
|
||||
println!("Specify output file name");
|
||||
exit(0);
|
||||
@ -37,12 +37,16 @@ impl CreateMode {
|
||||
|
||||
impl CreateMode {
|
||||
pub fn run(&mut self) -> Result<(), Error> {
|
||||
let snapshot = create_snapshot(self.root_path.as_str(), BLAKE3, vec![
|
||||
let snapshot = create_snapshot(
|
||||
self.root_path.as_str(),
|
||||
BLAKE3,
|
||||
vec![
|
||||
"/dev".to_string(),
|
||||
"/proc".to_string(),
|
||||
"/tmp".to_string(),
|
||||
"/sys".to_string(),
|
||||
])?;
|
||||
],
|
||||
)?;
|
||||
self.snapshot = snapshot.clone();
|
||||
if let Ok(e) = snapshot.file_hashes.lock() {
|
||||
println!("Total FileHash Entries {}", e.len());
|
||||
|
@ -13,9 +13,9 @@ fn main() {
|
||||
let _app = match options.command {
|
||||
Commands::Create {
|
||||
root_dir,
|
||||
output_path,
|
||||
output_path, verbose,
|
||||
} => {
|
||||
let mut create = CreateMode::new(output_path, root_dir);
|
||||
let mut create = CreateMode::new(output_path, root_dir, verbose);
|
||||
println!("Creating snapshot..");
|
||||
create.run()
|
||||
}
|
||||
@ -24,13 +24,14 @@ fn main() {
|
||||
right,
|
||||
selection,
|
||||
count_only,
|
||||
verbose,
|
||||
} => {
|
||||
if let Some(count_only) = count_only {
|
||||
if !count_only {
|
||||
println!("Running snapshot comparison..");
|
||||
}
|
||||
}
|
||||
let mut compare = CompareMode::new(left, right, selection, count_only);
|
||||
let mut compare = CompareMode::new(left, right, selection, count_only, verbose);
|
||||
compare.run()
|
||||
}
|
||||
};
|
||||
|
@ -16,20 +16,26 @@ pub enum Commands {
|
||||
/// Snapshot output/save location
|
||||
#[arg(short, long)]
|
||||
output_path: String,
|
||||
/// OPTIONAL: Increase verbosity
|
||||
#[arg(short, default_value="false", num_args = 0..2)]
|
||||
verbose: Option<bool>,
|
||||
},
|
||||
/// Compare two snapshots
|
||||
Compare {
|
||||
/// left side of diff
|
||||
/// Left side of diff
|
||||
#[arg(short, long)]
|
||||
left: String,
|
||||
/// right side of diff
|
||||
/// Right side of diff
|
||||
#[arg(short, long)]
|
||||
right: String,
|
||||
/// OPTIONAL: specify which change type specifically to return
|
||||
/// OPTIONAL: Wpecify which change type specifically to return
|
||||
#[arg(short, long)]
|
||||
selection: Option<String>,
|
||||
/// OPTIONAL: when using selection specify to return count only or not
|
||||
/// OPTIONAL: When using selection specify to return count only or not
|
||||
#[arg(short, default_value="false", num_args = 0..2)]
|
||||
count_only: Option<bool>,
|
||||
/// OPTIONAL: Increase verbosity
|
||||
#[arg(short, default_value="false", num_args = 0..2)]
|
||||
verbose: Option<bool>,
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user