Skip to content

Commit db2a2d5

Browse files
committed
Release 1.284.2025
1 parent 75b3808 commit db2a2d5

25 files changed

+1399
-1289
lines changed

Functions/GenXdev.FileSystem/EnsurePester.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Part of PowerShell module : GenXdev.FileSystem
33
Original cmdlet filename : EnsurePester.ps1
44
Original author : René Vaessen / GenXdev
5-
Version : 1.280.2025
5+
Version : 1.284.2025
66
################################################################################
77
MIT License
88

Functions/GenXdev.FileSystem/Expand-Path.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Part of PowerShell module : GenXdev.FileSystem
33
Original cmdlet filename : Expand-Path.ps1
44
Original author : René Vaessen / GenXdev
5-
Version : 1.280.2025
5+
Version : 1.284.2025
66
################################################################################
77
MIT License
88

Functions/GenXdev.FileSystem/Find-DuplicateFiles.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Part of PowerShell module : GenXdev.FileSystem
33
Original cmdlet filename : Find-DuplicateFiles.ps1
44
Original author : René Vaessen / GenXdev
5-
Version : 1.280.2025
5+
Version : 1.284.2025
66
################################################################################
77
MIT License
88

Functions/GenXdev.FileSystem/Find-Item.Cmdlet.cs

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Part of PowerShell module : GenXdev.FileSystem
33
// Original cmdlet filename : Find-Item.Cmdlet.cs
44
// Original author : René Vaessen / GenXdev
5-
// Version : 1.280.2025
5+
// Version : 1.284.2025
66
// ################################################################################
77
// MIT License
88
//
@@ -47,7 +47,7 @@ namespace GenXdev.FileSystem
4747
/// <para type="description">
4848
/// -Name &lt;String[]&gt;<br/>
4949
/// File name or pattern to search for. Default is '*'.<br/>
50-
/// - <b>Aliases</b>: like, l, Path, Query, SearchMask<br/>
50+
/// - <b>Aliases</b>: like, l, Path, LiteralPath, Query, SearchMask, Include<br/>
5151
/// - <b>Position</b>: 0<br/>
5252
/// - <b>Default</b>: "*"<br/>
5353
/// - <b>Features</b>:<br/>
@@ -71,7 +71,7 @@ namespace GenXdev.FileSystem
7171
/// </para>
7272

7373
/// <para type="description">
74-
/// -Content &lt;String&gt;<br/>
74+
/// -Content &lt;String[]&gt;<br/>
7575
/// Regular expression pattern to search within file contents<br/>
7676
/// - <b>Aliases</b>: mc, matchcontent, regex, Pattern<br/>
7777
/// - <b>Position</b>: 1<br/>
@@ -274,6 +274,15 @@ namespace GenXdev.FileSystem
274274
/// Only the first instance of matching text is returned from each input file. This is the most efficient way to retrieve a list of files that have contents matching the regular expression.<br/>
275275
/// </para>
276276

277+
/// <para type="description">
278+
/// -NoEmphasis &lt;SwitchParameter&gt;<br/>
279+
/// Disables highlighting of matching strings in output. By default, matching patterns are highlighted using negative colors based on your PowerShell theme.<br/>
280+
/// - <b>Features</b>:<br/>
281+
/// - Disables highlighting of pattern matches<br/>
282+
/// - Uses negative colors based on PowerShell background and text colors<br/>
283+
/// - Example: Black background with white text becomes white background with black text<br/>
284+
/// </para>
285+
277286
/// <para type="description">
278287
/// -NotMatch &lt;SwitchParameter&gt;<br/>
279288
/// The NotMatch parameter finds text that doesn't match the specified pattern.<br/>
@@ -581,7 +590,7 @@ public partial class FindItem : PSCmdlet
581590
/// <para type="description">File name or pattern to search for. Supports wildcards (*,?). Default is '*'</para>
582591
/// </summary>
583592
[Parameter(Position = 0, Mandatory = false, HelpMessage = "File name or pattern to search for. Default is '*'")]
584-
[Alias("like", "l", "Path", "Query", "SearchMask")]
593+
[Alias("like", "l", "Path", "LiteralPath", "Query", "SearchMask", "Include")]
585594
[ValidateNotNullOrEmpty()]
586595
[SupportsWildcards()]
587596
public string[] Name { get; set; }
@@ -601,7 +610,7 @@ public partial class FindItem : PSCmdlet
601610
[Alias("mc", "matchcontent", "regex", "Pattern")]
602611
[ValidateNotNull()]
603612
[SupportsWildcards()]
604-
public string Content { get; set; } = ".*";
613+
public string[] Content { get; set; } = new string[1] { ".*" };
605614

606615
/// <summary>
607616
/// <para type="description">Base path for resolving relative paths in output</para>
@@ -864,6 +873,19 @@ public partial class FindItem : PSCmdlet
864873
[Parameter(Mandatory = false, ParameterSetName = "WithPattern", HelpMessage = "Only the first instance of matching text is returned from each input file. This is the most efficient way to retrieve a list of files that have contents matching the regular expression.")]
865874
public SwitchParameter List { get; set; }
866875

876+
/// <summary>
877+
/// <para type="description">
878+
/// By default, Select-String highlights the string that matches the pattern you
879+
/// searched for with the Pattern parameter. The NoEmphasis parameter disables
880+
/// the highlighting. The emphasis uses negative colors based on your PowerShell
881+
/// background and text colors. For example, if your PowerShell colors are a
882+
/// black background with white text, the emphasis is a white background with
883+
/// black text.
884+
/// </para>
885+
/// </summary>
886+
[Parameter(Mandatory = false, ParameterSetName = "WithPattern", HelpMessage = "Disables highlighting of matching strings in output.")]
887+
public SwitchParameter NoEmphasis { get; set; }
888+
867889
/// <summary>
868890
/// <para type="description">The NotMatch parameter finds text that doesn't match the specified pattern.</para>
869891
/// </summary>
@@ -895,6 +917,9 @@ protected override void BeginProcessing()
895917
// set up verbose logging based on user preference
896918
InitializeVerboseOutput();
897919

920+
// configure buffering for large file processing
921+
InitializeBufferingConfiguration();
922+
898923
// set up parallelism based on user input or defaults
899924
InitializeParallelismConfiguration();
900925

@@ -916,9 +941,6 @@ protected override void BeginProcessing()
916941
// resolve base path for relative output
917942
InitializeRelativeBaseDir();
918943

919-
// configure buffering for large file processing
920-
InitializeBufferingConfiguration();
921-
922944
// set up cancellation with optional timeout
923945
InitializeCancellationToken();
924946

@@ -966,8 +988,7 @@ protected override void EndProcessing()
966988

967989
// clear all queues
968990
EmptyQueues();
969-
MatchContentProcessor p;
970-
while (MatchContentProcessors.TryDequeue(out p)) ;
991+
MatchContentProcessor p; while (MatchContentProcessors.TryDequeue(out p)) ;
971992
GC.Collect();
972993

973994
// create completion progress record

Functions/GenXdev.FileSystem/Find-Item.Fields.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Part of PowerShell module : GenXdev.FileSystem
33
// Original cmdlet filename : Find-Item.Fields.cs
44
// Original author : René Vaessen / GenXdev
5-
// Version : 1.280.2025
5+
// Version : 1.284.2025
66
// ################################################################################
77
// MIT License
88
//
@@ -32,6 +32,7 @@
3232
using System.Collections.Concurrent;
3333
using System.Management.Automation;
3434
using System.Runtime.InteropServices;
35+
using System.Text;
3536
using System.Text.RegularExpressions;
3637

3738
namespace GenXdev.FileSystem
@@ -181,9 +182,11 @@ public partial class FindItem : PSCmdlet
181182
protected readonly ConcurrentQueue<string> VerboseQueue = new();
182183
protected readonly ConcurrentQueue<FileInfo> FileContentMatchQueue = new();
183184
private readonly ConcurrentQueue<MatchContentProcessor> MatchContentProcessors = new();
184-
185+
185186
protected readonly List<Task> Workers = new List<Task>();
186187
protected readonly object WorkersLock = new object();
188+
protected readonly StringBuilder statusBuilder = new StringBuilder(256);
189+
187190

188191
// Cancellation source to handle timeouts and user interruptions gracefully
189192
protected CancellationTokenSource cts;
@@ -203,6 +206,18 @@ public partial class FindItem : PSCmdlet
203206
protected long matchesQueued;
204207
protected long dirsCompleted;
205208

209+
// Throughput measurement fields for adaptive scaling (thread-safe)
210+
protected long lastThroughputMeasurement = DateTime.UtcNow.Ticks;
211+
protected long lastDirsCompleted = 0;
212+
protected long lastMatchesCompleted = 0;
213+
protected long lastOutputCount = 0;
214+
protected long currentDirThroughputx100 = 0; // directories/second * 100 (for precision)
215+
protected long currentMatchThroughputx100 = 0; // matches/second * 100 (for precision)
216+
protected long currentOutputThroughputx100 = 0; // outputs/second * 100 (for precision)
217+
protected long recommendedDirectoryWorkers = 0;
218+
protected long recommendedMatchWorkers = 0;
219+
protected readonly object throughputLock = new object(); // Lock for measurement updates
220+
206221
// Store original thread pool settings to restore after cmdlet execution
207222
protected int oldMaxWorkerThread;
208223
protected int oldMaxCompletionPorts;
@@ -216,8 +231,8 @@ public partial class FindItem : PSCmdlet
216231

217232
protected int oldMaxWorkerThreads;
218233
protected bool isStarted;
219-
protected bool usingSelectString;
220-
234+
protected bool matchingFileContent;
235+
221236
/// <summary>
222237
/// Flag for enabling verbose output based on user preferences
223238
/// </summary>

0 commit comments

Comments
 (0)