1
0
mirror of https://github.com/oliverbooth/fdup.git synced 2024-12-04 18:48:48 +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)
{
var tasks = new List<Task>();
SearchDuplicates(inputDirectory, settings, tasks);
SearchDuplicates(ctx, inputDirectory, settings, tasks);
await Task.Run(() =>
{
int incompleteTasks;
@ -80,15 +80,14 @@ internal sealed class ListCommand : AsyncCommand<ListSettings>
}).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]);
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);