increase verbosity
This commit is contained in:
parent
1e5d0d4680
commit
fe98279228
@ -11,7 +11,7 @@ readme = "README.md"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
filesystem-hashing = "0.3.1"
|
||||
filesystem-hashing = "0.3.4"
|
||||
clap = { version = "4.5.4", features = ["derive"] }
|
||||
whoami = "1.5.1"
|
||||
anyhow = "1.0.82"
|
||||
|
@ -11,6 +11,7 @@ pub struct CompareMode {
|
||||
#[allow(unused)]
|
||||
result_type: SnapshotChangeType,
|
||||
results: SnapshotCompareResult,
|
||||
verbose: bool
|
||||
}
|
||||
|
||||
impl CompareMode {
|
||||
@ -21,8 +22,13 @@ impl CompareMode {
|
||||
count_only: Option<bool>,
|
||||
verbose: Option<bool>,
|
||||
) -> CompareMode {
|
||||
let left = import_snapshot(left).unwrap_or_default();
|
||||
let right = import_snapshot(right).unwrap_or_default();
|
||||
let mut verbosity = false;
|
||||
if let Some(_v) = verbose {
|
||||
verbosity = true
|
||||
}
|
||||
|
||||
let left = import_snapshot(left, verbosity).unwrap_or_default();
|
||||
let right = import_snapshot(right, verbosity).unwrap_or_default();
|
||||
|
||||
CompareMode {
|
||||
left,
|
||||
@ -35,18 +41,19 @@ impl CompareMode {
|
||||
deleted: vec![],
|
||||
changed: vec![],
|
||||
},
|
||||
verbose: verbosity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CompareMode {
|
||||
pub(crate) fn run(&mut self) -> Result<(), Error> {
|
||||
pub(crate) fn run(&mut self, verbose: Option<bool>) -> Result<(), Error> {
|
||||
let selector = match &self.selection {
|
||||
None => "none",
|
||||
Some(r) => r.as_str(),
|
||||
};
|
||||
|
||||
let results = match compare_snapshots(self.left.clone(), self.right.clone()) {
|
||||
let results = match compare_snapshots(self.left.clone(), self.right.clone(), self.verbose) {
|
||||
Some(x) => x,
|
||||
None => panic!("Error Comparing Snapshot"),
|
||||
};
|
||||
|
@ -9,10 +9,21 @@ pub struct CreateMode {
|
||||
snapshot_path: String,
|
||||
root_path: String,
|
||||
snapshot: Snapshot,
|
||||
verbose: bool,
|
||||
}
|
||||
|
||||
impl CreateMode {
|
||||
pub fn new(snapshot_path: String, root_path: String, verbose: Option<bool>) -> CreateMode {
|
||||
let mut verbosity = false;
|
||||
match verbose {
|
||||
Some(_v) => {
|
||||
verbosity = true
|
||||
},
|
||||
None => {
|
||||
verbosity = false
|
||||
}
|
||||
}
|
||||
|
||||
if snapshot_path.replace("./", "").is_empty() {
|
||||
println!("Specify output file name");
|
||||
exit(0);
|
||||
@ -31,12 +42,22 @@ impl CreateMode {
|
||||
uuid: "".to_string(),
|
||||
date_created: 0,
|
||||
},
|
||||
verbose: verbosity,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CreateMode {
|
||||
pub fn run(&mut self) -> Result<(), Error> {
|
||||
pub fn run(&mut self, verbose: Option<bool>) -> Result<(), Error> {
|
||||
let mut verbosity = false;
|
||||
match verbose {
|
||||
Some(v) => {
|
||||
verbosity = v
|
||||
},
|
||||
None => {
|
||||
verbosity = true
|
||||
}
|
||||
}
|
||||
let snapshot = create_snapshot(
|
||||
self.root_path.as_str(),
|
||||
BLAKE3,
|
||||
@ -46,12 +67,13 @@ impl CreateMode {
|
||||
"/tmp".to_string(),
|
||||
"/sys".to_string(),
|
||||
],
|
||||
verbosity
|
||||
)?;
|
||||
self.snapshot = snapshot.clone();
|
||||
if let Ok(e) = snapshot.file_hashes.lock() {
|
||||
println!("Total FileHash Entries {}", e.len());
|
||||
}
|
||||
export_snapshot(self.snapshot.clone(), self.snapshot_path.clone(), true)?;
|
||||
export_snapshot(self.snapshot.clone(), self.snapshot_path.clone(), true, self.verbose)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,8 @@ fn main() {
|
||||
} => {
|
||||
let mut create = CreateMode::new(output_path, root_dir, verbose);
|
||||
println!("Creating snapshot..");
|
||||
create.run()
|
||||
println!("{:?}", verbose);
|
||||
create.run(verbose)
|
||||
}
|
||||
Commands::Compare {
|
||||
left,
|
||||
@ -32,7 +33,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
let mut compare = CompareMode::new(left, right, selection, count_only, verbose);
|
||||
compare.run()
|
||||
compare.run(verbose)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user