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