Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/commands/organize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub fn run(
content_filter: Option<String>,
template: Option<String>,
on_conflict: ConflictStrategy,
show_all_files: bool,
) -> Result<()> {
// Determine mode
let mode = if by_date {
Expand Down Expand Up @@ -114,6 +115,7 @@ pub fn run(
content_filter.clone(),
template.clone(),
on_conflict,
show_all_files,
)?;
}

Expand Down Expand Up @@ -144,6 +146,7 @@ fn organize_single_path(
content_filter: Option<String>,
template: Option<String>,
on_conflict: ConflictStrategy,
show_all_files: bool,
) -> Result<()> {
let canonical_path = path
.canonicalize()
Expand Down Expand Up @@ -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(())
Expand Down
2 changes: 1 addition & 1 deletion src/commands/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/commands/quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down Expand Up @@ -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(())
Expand Down Expand Up @@ -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(())
Expand Down
9 changes: 5 additions & 4 deletions src/core/organizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ fn main() -> Result<()> {
content,
template,
on_conflict,
show_all_files,
} => {
commands::organize::run(
&paths,
Expand Down Expand Up @@ -75,6 +76,7 @@ fn main() -> Result<()> {
content,
template,
on_conflict,
show_all_files,
)?;
}

Expand Down