about summary refs log tree commit diff
path: root/squash/src/main.rs
diff options
context:
space:
mode:
authorgennyble <gen@nyble.dev>2023-10-15 19:37:27 -0500
committergennyble <gen@nyble.dev>2023-10-15 19:37:27 -0500
commit29677eba58cebd1165eadb3de869f8957824ee79 (patch)
tree9ba1720f225d753896bb78728ed822ca7386c51c /squash/src/main.rs
parent244c33a07952f0ee22cc3641f35eb5af55f405f1 (diff)
downloadcolorsquash-29677eba58cebd1165eadb3de869f8957824ee79.tar.gz
colorsquash-29677eba58cebd1165eadb3de869f8957824ee79.zip
dd style cli
Diffstat (limited to 'squash/src/main.rs')
-rw-r--r--squash/src/main.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/squash/src/main.rs b/squash/src/main.rs
index d5cd2d8..8b77b47 100644
--- a/squash/src/main.rs
+++ b/squash/src/main.rs
@@ -7,7 +7,7 @@ mod image;
 
 fn main() -> Result<(), anyhow::Error> {
 	//gen: I should use clap or at least getopt, but this is fine.
-	let cli = cli::get();
+	let cli = cli::build();
 
 	let mut image = match cli.in_type {
 		InType::Png => image::get_png(cli.input)?,
@@ -15,15 +15,14 @@ fn main() -> Result<(), anyhow::Error> {
 	};
 
 	let mut squasher = Squasher::new(cli.color_count, &image.data);
+
+	if let Some(tol) = cli.tolerance {
+		squasher.set_tolerance(tol);
+	}
+
 	let size = squasher.map_over(&mut image.data);
 	image.data.resize(size, 0);
 
-	println!(
-		"selected {} colours of max {}",
-		squasher.palette().len(),
-		cli.color_count
-	);
-
 	match cli.out_type {
 		OutType::Png => image::save_png(image, squasher, cli.output),
 		OutType::Gif => image::save_gif(image, squasher, cli.output),