mirror of
https://github.com/eRgo35/ascii.git
synced 2026-02-04 04:46:09 +01:00
stdin read
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -5,8 +5,20 @@ fn main() {
|
||||
println!("ASCII Generator\n----------------");
|
||||
|
||||
let args = libs::args::Args::parse();
|
||||
let path = args.image.clone();
|
||||
|
||||
let mut img = if !path.is_empty() {
|
||||
libs::image::load_image(&path)
|
||||
} else {
|
||||
match libs::image::load_image_from_stdin() {
|
||||
Ok(img) => img,
|
||||
Err(e) => {
|
||||
eprintln!("Error: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let mut img = libs::image::load_image(&args.image);
|
||||
libs::image::print_size(&img);
|
||||
|
||||
if !args.noresize {
|
||||
|
||||
Reference in New Issue
Block a user