Skip to content

Commit

Permalink
add truncate warning
Browse files Browse the repository at this point in the history
  • Loading branch information
PoshAJ authored and PoshAJ committed Sep 6, 2024
1 parent 81edd27 commit 9fbaaca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/PSADTree/PSADTreeCmdletBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public abstract class PSADTreeCmdletBase : PSCmdlet, IDisposable

private bool _disposed;

private bool _truncateWritten;

protected readonly Stack<(GroupPrincipal? group, TreeGroup treeGroup)> _stack = new();

internal readonly TreeCache _cache = new();
Expand Down Expand Up @@ -87,6 +89,14 @@ protected void Push(GroupPrincipal? groupPrincipal, TreeGroup treeGroup)
{
_stack.Push((groupPrincipal, treeGroup));
}
else
{
if (!_truncateWritten)
{
this.WriteWarning($"Result is truncated as enumeration has exceeded the set depth of {Depth}.");
_truncateWritten = true;
}
}
}

private static bool MatchAny(
Expand Down

0 comments on commit 9fbaaca

Please sign in to comment.