2024-03-18 22:20:57 +00:00
|
|
|
pub mod comparemode;
|
2024-03-26 17:14:24 +00:00
|
|
|
pub mod createmode;
|
2024-03-28 23:05:09 +00:00
|
|
|
mod options;
|
2024-03-18 20:38:10 +00:00
|
|
|
|
2024-03-29 04:18:38 +00:00
|
|
|
use crate::comparemode::CompareMode;
|
|
|
|
use crate::createmode::CreateMode;
|
2024-03-28 23:05:09 +00:00
|
|
|
use crate::options::{Arguments, Commands};
|
2024-04-08 22:38:35 +00:00
|
|
|
use clap::Parser;
|
2024-03-18 20:38:10 +00:00
|
|
|
|
2024-03-18 19:33:42 +00:00
|
|
|
fn main() {
|
2024-03-28 23:05:09 +00:00
|
|
|
let options = Arguments::parse();
|
2024-03-18 20:38:10 +00:00
|
|
|
|
2024-03-29 04:21:51 +00:00
|
|
|
let _app = match options.command {
|
2024-04-08 22:38:35 +00:00
|
|
|
Commands::Create {
|
|
|
|
root_dir,
|
2024-04-21 17:42:54 +00:00
|
|
|
output_path, verbose,
|
2024-04-08 22:38:35 +00:00
|
|
|
} => {
|
2024-04-21 17:42:54 +00:00
|
|
|
let mut create = CreateMode::new(output_path, root_dir, verbose);
|
2024-03-29 04:18:38 +00:00
|
|
|
println!("Creating snapshot..");
|
|
|
|
create.run()
|
2024-04-08 22:38:35 +00:00
|
|
|
}
|
|
|
|
Commands::Compare {
|
|
|
|
left,
|
|
|
|
right,
|
|
|
|
selection,
|
|
|
|
count_only,
|
2024-04-21 17:42:54 +00:00
|
|
|
verbose,
|
2024-04-08 22:38:35 +00:00
|
|
|
} => {
|
2024-03-29 20:50:09 +00:00
|
|
|
if let Some(count_only) = count_only {
|
|
|
|
if !count_only {
|
|
|
|
println!("Running snapshot comparison..");
|
|
|
|
}
|
|
|
|
}
|
2024-04-21 17:42:54 +00:00
|
|
|
let mut compare = CompareMode::new(left, right, selection, count_only, verbose);
|
2024-03-29 04:18:38 +00:00
|
|
|
compare.run()
|
2024-03-18 20:38:10 +00:00
|
|
|
}
|
|
|
|
};
|
2024-03-18 19:33:42 +00:00
|
|
|
}
|
2024-03-21 21:24:08 +00:00
|
|
|
|
|
|
|
// #[cfg(test)]
|
|
|
|
// mod tests {
|
|
|
|
// #[test]
|
|
|
|
// fn test() {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|