1
0
mirror of https://github.com/oliverbooth/fdup.git synced 2024-11-09 23:25:42 +00:00

perf: remove output of every filename

This commit is contained in:
Oliver Booth 2024-04-17 19:22:49 +01:00
parent 801dfe09cb
commit 4e723362ae
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

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