Skip to content

Commit

Permalink
fix conditional for truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
PoshAJ authored and PoshAJ committed Sep 6, 2024
1 parent d6ef8a1 commit 83ee2a8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/PSADTree/PSADTreeCmdletBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,15 @@ protected override void BeginProcessing()

protected void Push(GroupPrincipal? groupPrincipal, TreeGroup treeGroup)
{
if (Recursive.IsPresent || treeGroup.Depth <= Depth)
if (!Recursive.IsPresent && treeGroup.Depth >= Depth && !_truncateWritten)
{
_stack.Push((groupPrincipal, treeGroup));
this.WriteWarning($"Result is truncated as enumeration has exceeded the set depth of {Depth}.");
_truncateWritten = true;
}
else

if (Recursive.IsPresent || treeGroup.Depth <= Depth)
{
if (!_truncateWritten)
{
this.WriteWarning($"Result is truncated as enumeration has exceeded the set depth of {Depth}.");
_truncateWritten = true;
}
_stack.Push((groupPrincipal, treeGroup));
}
}

Expand Down

0 comments on commit 83ee2a8

Please sign in to comment.