init
This commit is contained in:
parent
942f4f69a8
commit
86ff8d5575
@ -1,4 +1,4 @@
|
|||||||
use Fasching::create_snapshot;
|
use Fasching::{create_snapshot, export_snapshot};
|
||||||
use Fasching::hasher::HashType::BLAKE3;
|
use Fasching::hasher::HashType::BLAKE3;
|
||||||
use Fasching::snapshot::Snapshot;
|
use Fasching::snapshot::Snapshot;
|
||||||
use crate::syscompare::Comparer;
|
use crate::syscompare::Comparer;
|
||||||
@ -12,6 +12,10 @@ pub struct CreateMode {
|
|||||||
|
|
||||||
impl CreateMode {
|
impl CreateMode {
|
||||||
pub fn new(args: Vec<String>, in_path: String, out_path: String) -> CreateMode {
|
pub fn new(args: Vec<String>, in_path: String, out_path: String) -> CreateMode {
|
||||||
|
if out_path.replace("./", "").is_empty() {
|
||||||
|
panic!("Specify output file name")
|
||||||
|
}
|
||||||
|
|
||||||
CreateMode { in_path, out_path, args, snapshot: Default::default() }
|
CreateMode { in_path, out_path, args, snapshot: Default::default() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,6 +23,7 @@ impl CreateMode {
|
|||||||
impl Comparer for CreateMode {
|
impl Comparer for CreateMode {
|
||||||
fn run(&self) {
|
fn run(&self) {
|
||||||
let snapshot = create_snapshot(self.in_path.as_str(), BLAKE3);
|
let snapshot = create_snapshot(self.in_path.as_str(), BLAKE3);
|
||||||
println!("{}", snapshot.file_hashes.lock().unwrap().len())
|
println!("Total FileHash Entries {}", snapshot.file_hashes.lock().unwrap().len());
|
||||||
|
let _ = export_snapshot(snapshot, self.out_path.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user