.
This commit is contained in:
parent
b00c02a50d
commit
81681ea69c
@ -11,8 +11,7 @@ readme = "README.md"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
#Fasching = "0.2.0"
|
Fasching = "0.2.0"
|
||||||
Fasching = {path = "../Fasching/"}
|
|
||||||
|
|
||||||
clap = { version = "4.5.4", features = ["derive"] }
|
clap = { version = "4.5.4", features = ["derive"] }
|
||||||
whoami = "1.5.1"
|
whoami = "1.5.1"
|
||||||
|
anyhow = "1.0.81"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use anyhow::Error;
|
||||||
use Fasching::snapshot::{Snapshot, SnapshotChangeType, SnapshotCompareResult};
|
use Fasching::snapshot::{Snapshot, SnapshotChangeType, SnapshotCompareResult};
|
||||||
use Fasching::{compare_snapshots, import_snapshot};
|
use Fasching::{compare_snapshots, import_snapshot};
|
||||||
use crate::options::Arguments;
|
use crate::options::Arguments;
|
||||||
@ -34,7 +35,7 @@ impl CompareMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CompareMode {
|
impl CompareMode {
|
||||||
pub(crate) fn run(&mut self) {
|
pub(crate) fn run(&mut self) -> Result<(), Error> {
|
||||||
let selector = match &self.selection {
|
let selector = match &self.selection {
|
||||||
None => "none",
|
None => "none",
|
||||||
Some(r) => {
|
Some(r) => {
|
||||||
@ -65,7 +66,7 @@ impl CompareMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
match selector {
|
Ok(match selector {
|
||||||
"created" => {
|
"created" => {
|
||||||
print_if_not_empty!(self.results.created, self.count_only);
|
print_if_not_empty!(self.results.created, self.count_only);
|
||||||
}
|
}
|
||||||
@ -81,14 +82,11 @@ impl CompareMode {
|
|||||||
println!("Changed: {:?}", self.results.changed.len());
|
println!("Changed: {:?}", self.results.changed.len());
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// println!("Created: {:?}", self.results.created.len());
|
println!("Created: {:?}", self.results.created.len());
|
||||||
// println!("Deleted: {:?}", self.results.deleted.len());
|
println!("Deleted: {:?}", self.results.deleted.len());
|
||||||
// println!("Changed: {:?}", self.results.changed.len());
|
println!("Changed: {:?}", self.results.changed.len());
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
|
||||||
fn return_ret(&self) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
use anyhow::Error;
|
||||||
use Fasching::hasher::HashType::BLAKE3;
|
use Fasching::hasher::HashType::BLAKE3;
|
||||||
use Fasching::snapshot::Snapshot;
|
use Fasching::snapshot::Snapshot;
|
||||||
use Fasching::{create_snapshot, export_snapshot};
|
use Fasching::{create_snapshot, export_snapshot};
|
||||||
@ -35,12 +36,13 @@ impl CreateMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CreateMode {
|
impl CreateMode {
|
||||||
pub fn run(&mut self) {
|
pub fn run(&mut self) -> Result<(), Error> {
|
||||||
let snapshot = create_snapshot(self.root_path.as_str(), BLAKE3, vec![]).unwrap();
|
let snapshot = create_snapshot(self.root_path.as_str(), BLAKE3, vec![])?;
|
||||||
self.snapshot = snapshot.clone();
|
self.snapshot = snapshot.clone();
|
||||||
if let Ok(e) = snapshot.file_hashes.lock() {
|
if let Ok(e) = snapshot.file_hashes.lock() {
|
||||||
println!("Total FileHash Entries {}", e.len());
|
println!("Total FileHash Entries {}", e.len());
|
||||||
}
|
}
|
||||||
export_snapshot(self.snapshot.clone(), self.snapshot_path.clone(), true).unwrap();
|
export_snapshot(self.snapshot.clone(), self.snapshot_path.clone(), true)?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user