diff --git a/FindDuplicates/ListCommand.cs b/FindDuplicates/ListCommand.cs index 66669c8..cfbe542 100644 --- a/FindDuplicates/ListCommand.cs +++ b/FindDuplicates/ListCommand.cs @@ -65,7 +65,7 @@ internal sealed class ListCommand : AsyncCommand StatusContext ctx) { var tasks = new List(); - SearchDuplicates(inputDirectory, settings, tasks); + SearchDuplicates(ctx, inputDirectory, settings, tasks); await Task.Run(() => { int incompleteTasks; @@ -80,15 +80,14 @@ internal sealed class ListCommand : AsyncCommand }).ConfigureAwait(false); } - private void SearchDuplicates(DirectoryInfo inputDirectory, ListSettings settings, ICollection tasks) + private void SearchDuplicates(StatusContext ctx, DirectoryInfo inputDirectory, ListSettings settings, ICollection tasks) { var directoryStack = new Stack([inputDirectory]); + while (directoryStack.Count > 0) { DirectoryInfo currentDirectory = directoryStack.Pop(); - string relativePath = Path.GetRelativePath(inputDirectory.FullName, currentDirectory.FullName); - if (relativePath != ".") - AnsiConsole.MarkupLineInterpolated($"Searching [cyan]{relativePath}[/]"); + ctx.Status(currentDirectory.FullName.EscapeMarkup()); AddChildDirectories(settings, currentDirectory, directoryStack);