| Package | Kind | Role |
|---|---|---|
| library | Parses |
|
| library | Depth-first directory walker; fires callable delegates for each directory and file | |
| 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 |
# Search the current directory tree for Python files containing "def " python EntryPoint/PyTextFinder.py /P . /p py /r "def " # Git Bash / MINGW users - use - prefix to avoid shell path expansion python EntryPoint/PyTextFinder.py -P . -p py -r "def "
| 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 | |
| (flag) | off | Run the built-in test suite and exit |
# Find all Python files containing "class" under the repo root python EntryPoint/PyTextFinder.py /P . /p py /r "class" # Search source and markdown files for a TODO comment, show all directories python EntryPoint/PyTextFinder.py /P . /p "py,md" /r "TODO" /H false # Verbose output - shows resolved path, extensions, and regex before searching python EntryPoint/PyTextFinder.py /P .. /p py /r "def " /v
PyTextFinder
==============
searching path: "."
extensions: ["py"]
matching files with regex: "def "
./DirNav
"dir_nav.py"
./EntryPoint
"PyTextFinder.py"
2 files matched out of 8 visited in 4 dirs
on_dir(path: str) # called when entering a directory on_file(path: str) # called for each file whose extension is in the filter list
| Language / tool | Skipped names |
|---|---|
| C# / .NET | |
| Rust | |
| C++ | |
| Python | |
| VCS / IDE | |
| Archives |
# Verify Python version python --version # should show 3.10 or later # Run directly from the repo root python EntryPoint/PyTextFinder.py -P . -p py -r "def " # PowerShell / cmd.exe can use / prefix python EntryPoint/PyTextFinder.py /P . /p py /r "def "
# Run the built-in test suite via the -T flag python EntryPoint/PyTextFinder.py -T # Or use the standard unittest runner python -m unittest discover -s . -p "test_*.py" # Functional smoke test - search this repo for Python files containing "def " python EntryPoint/PyTextFinder.py -P . -p py -r "def " /v
| Module | Source | Used by | Purpose |
|---|---|---|---|
| Python stdlib | Compile and match regular expressions against file content | ||
| Python stdlib | Directory enumeration and path manipulation | ||
| Python stdlib | Command-line argument access | ||
| Python stdlib | test modules | Unit testing framework |