commit f8d9d1eb6933a52a8b6d3fa2042bbfe77d2db3e3 from: mtmn date: Sat May 9 12:13:49 2026 UTC fix: default path to cwd when unset commit - 9c90aa6a7e08208ffbba2608177ae7a6699db590 commit + f8d9d1eb6933a52a8b6d3fa2042bbfe77d2db3e3 blob - bcdbb004e905036e201f005ad461959c484c3bba blob + 14b1e325218da8d17613215ddfd35d19888d25f5 --- README.md +++ README.md @@ -27,7 +27,7 @@ cargo build --release ### Arguments -* `...`: One or more files or directories to analyze. +* `...`: One or more files or directories to analyze. Defaults to the current directory when not provided. ### Options @@ -58,6 +58,9 @@ cargo build --release # Edit tags for a single file (interactive) ./target/release/hakuna --edit file.flac +# Edit tags for all files in the current directory +./target/release/hakuna --edit + # Write metadata to all files in a directory ./target/release/hakuna -d DISCOGS_TOKEN --write --all /path/to/music/ blob - bfa784ffd1106f2219dcad0d6c77aa42ae3fb8b9 blob + 87c4847e27a5460b34e56be5bf213760afccae74 --- src/main.rs +++ src/main.rs @@ -30,6 +30,9 @@ use walkdir::WalkDir; Edit tags manually: $ hakuna --edit file.mp3 + Edit tags in current directory: + $ hakuna --edit + Process a directory: $ hakuna -d DISCOGS_TOKEN -w /path/to/music/" )] @@ -44,7 +47,8 @@ struct Args { album: Option, /// File(s) to process - #[arg(required_unless_present_any = ["artist", "album", "show_tags"])] + /// File(s) to process, defaults to current directory + #[arg()] files: Vec, /// Write tags to file @@ -109,10 +113,18 @@ async fn main() -> Result<()> { let args = Args::parse(); let ctx = AppContext::new(args.discogs_token)?; - if !args.files.is_empty() { + let files = if args.files.is_empty() + && (args.edit || args.show_tags || args.write || args.r#move) + { + vec![".".to_string()] + } else { + args.files + }; + + if !files.is_empty() { let mut all_files = Vec::new(); - for path_str in &args.files { + for path_str in &files { let path = Path::new(path_str); if !path.exists() { eprintln!("Path does not exist: {}", path.display());