diff --git a/src/cli.rs b/src/cli.rs index fb296b8..db33fed 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -142,6 +142,10 @@ pub enum Commands { /// How to handle file conflicts (skip, overwrite, rename, ask) #[arg(long, value_parser = parse_conflict_strategy, default_value = "rename")] on_conflict: ConflictStrategy, + + /// Show all files in each folder + #[arg(long)] + show_all_files: bool, }, /// Clean old files from a directory diff --git a/src/commands/organize.rs b/src/commands/organize.rs index 54473ca..ad6ed8a 100644 --- a/src/commands/organize.rs +++ b/src/commands/organize.rs @@ -42,6 +42,7 @@ pub fn run( content_filter: Option, template: Option, on_conflict: ConflictStrategy, + show_all_files: bool, ) -> Result<()> { // Determine mode let mode = if by_date { @@ -114,6 +115,7 @@ pub fn run( content_filter.clone(), template.clone(), on_conflict, + show_all_files, )?; } @@ -144,6 +146,7 @@ fn organize_single_path( content_filter: Option, template: Option, on_conflict: ConflictStrategy, + show_all_files: bool, ) -> Result<()> { let canonical_path = path .canonicalize() @@ -237,7 +240,7 @@ fn organize_single_path( print_results(&result); } } else { - preview_moves(&moves, &canonical_path); + preview_moves(&moves, &canonical_path, show_all_files); } Ok(()) diff --git a/src/commands/profile.rs b/src/commands/profile.rs index 3ddf6c2..e589905 100644 --- a/src/commands/profile.rs +++ b/src/commands/profile.rs @@ -370,7 +370,7 @@ fn run_profile(profile: &Profile, execute: bool) -> Result<()> { let result = execute_moves(&moves, &cmd_name, conflict_strategy)?; print_results(&result); } else { - preview_moves(&moves, &canonical); + preview_moves(&moves, &canonical, false); } } diff --git a/src/commands/quick.rs b/src/commands/quick.rs index 566117c..26de78f 100644 --- a/src/commands/quick.rs +++ b/src/commands/quick.rs @@ -102,7 +102,7 @@ fn organize_by_type(path: &std::path::Path, execute: bool, name: &str) -> Result let result = execute_moves(&moves, &format!("quick {}", name), ConflictStrategy::Rename)?; print_results(&result); } else { - preview_moves(&moves, path); + preview_moves(&moves, path, false); } Ok(()) @@ -138,7 +138,7 @@ fn organize_photos(path: &std::path::Path, execute: bool) -> Result<()> { let result = execute_moves(&moves, "quick photos", ConflictStrategy::Rename)?; print_results(&result); } else { - preview_moves(&moves, path); + preview_moves(&moves, path, false); } Ok(()) @@ -177,7 +177,7 @@ fn organize_music(path: &std::path::Path, execute: bool) -> Result<()> { let result = execute_moves(&moves, "quick music", ConflictStrategy::Rename)?; print_results(&result); } else { - preview_moves(&moves, path); + preview_moves(&moves, path, false); } Ok(()) diff --git a/src/core/organizer.rs b/src/core/organizer.rs index 7eca06b..9b6f0b6 100644 --- a/src/core/organizer.rs +++ b/src/core/organizer.rs @@ -220,7 +220,7 @@ pub fn plan_moves_with_template( } /// Preview planned moves (dry-run) -pub fn preview_moves(moves: &[PlannedMove], base_path: &Path) { +pub fn preview_moves(moves: &[PlannedMove], base_path: &Path, show_all_files: bool) { if moves.is_empty() { println!("{}", "No files to move.".yellow()); return; @@ -249,13 +249,14 @@ pub fn preview_moves(moves: &[PlannedMove], base_path: &Path) { files.len() ); - // Show first 5 files in each folder - for mv in files.iter().take(5) { + // Show files based on show_all_files flag + let display_count = if show_all_files { files.len() } else { 5 }; + for mv in files.iter().take(display_count) { let from_name = mv.from.file_name().unwrap_or_default().to_string_lossy(); println!(" {} {}", "→".dimmed(), from_name); } - if files.len() > 5 { + if !show_all_files && files.len() > 5 { println!(" {} ... and {} more", "→".dimmed(), files.len() - 5); } } diff --git a/src/main.rs b/src/main.rs index 51c2448..219e7da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,6 +47,7 @@ fn main() -> Result<()> { content, template, on_conflict, + show_all_files, } => { commands::organize::run( &paths, @@ -75,6 +76,7 @@ fn main() -> Result<()> { content, template, on_conflict, + show_all_files, )?; }