gen-wallpapers: "cli" example is just a binary
This commit is contained in:
parent
627f52f16d
commit
3f478f5353
3 changed files with 1 additions and 3 deletions
31
crates/gen-wallpapers/src/main.rs
Normal file
31
crates/gen-wallpapers/src/main.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
use clap::Parser;
|
||||
use gen_wallpapers::MetadataList;
|
||||
use std::fs::read_dir;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Cli {
|
||||
folder: PathBuf,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let cli = Cli::parse();
|
||||
let dir = match read_dir(cli.folder) {
|
||||
Ok(dir) => dir,
|
||||
Err(e) => {
|
||||
eprintln!("failed to read folder: {e}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let metadata = MetadataList::process_folder(dir, true);
|
||||
|
||||
let json = match metadata.to_pretty_json() {
|
||||
Ok(json) => json,
|
||||
Err(e) => {
|
||||
eprintln!("failed to serialize json: {e}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
println!("{json}");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue