| Package | Kind | Role |
|---|---|---|
| library | Parses |
|
| library | Depth-first directory walker; fires |
|
| library | Reads file content, tests it against a compiled regex, and writes matching results to the console | |
| executable | Application - wires the packages, parses options, and drives the search |
# 1. Build (from the CsTextFinder/ solution root) dotnet build # 2. Search the current directory tree for C# files containing "Action" dotnet run --project EntryPoint -- /P . /p cs /r "Action" # 3. Or run the built executable directly EntryPoint/bin/Debug/net10.0/CsTextFinder.exe /P . /p cs /r "Action" # Git Bash / MINGW users - use - prefix to avoid shell path expansion dotnet run --project EntryPoint -- -P . -p cs -r "Action"
| Option | Argument | Default | Meaning |
|---|---|---|---|
| path | Root directory for the search | ||
| extensions | (all files) | Comma-separated file extensions to include, e.g. |
|
| regex | Regular expression matched against file content | ||
| Recurse into subdirectories | |||
|
|
|||
| (flag) | off | Print all resolved options before searching | |
| (flag) | off | Print help and exit |
# Find all C# files containing "interface" under the solution root CsTextFinder.exe /P . /p cs /r "interface" # Search source and markdown files for a TODO comment, show all directories CsTextFinder.exe /P . /p "cs,md" /r "TODO" /H false # Verbose output - shows resolved path, extensions, and regex before searching CsTextFinder.exe /P .. /p cs /r "Action" /v
CsTextFinder ver 1.0.0
========================
searching path: "."
extensions: ["cs"]
matching files with regex: "Action"
./DirNav
"DirNav.cs"
./EntryPoint
"Program.cs"
2 files matched out of 12 visited in 4 dirs
That's all Folks!
Action<string> OnDir // called when entering a directory Action<string> OnFile // called for each file whose extension is in the filter list
# Verify SDK version dotnet --version # should show 10.x # Build all projects (from the CsTextFinder/ solution root) dotnet build # Build Release configuration dotnet build -c Release # Run directly from source dotnet run --project EntryPoint -- /P . /p cs /r "TODO" # Clean build outputs dotnet clean
# Functional smoke test - search this repo for all C# files containing "Action" cd CsTextFinder dotnet run --project EntryPoint -- /P . /p cs /r "Action" /v # Search for interface definitions dotnet run --project EntryPoint -- /P . /p cs /r "interface\s+I\w+" # Test /H false (real-time directory output) dotnet run --project EntryPoint -- /P . /p cs /r "class" /H false
| Namespace / Type | Source | Used by | Purpose |
|---|---|---|---|
| .NET BCL | Compile and match regular expressions against file content | ||
| .NET BCL | Directory enumeration and file reading |