Dynamic File Content Searcher: A Developer's Best Friend for Code Search

Dynamic File Content Searcher: A Developer's Best Friend for Code Search

Are you tired of searching through countless files in your project to find specific strings, variables, or patterns? Meet Dynamic File Content Searcher, a powerful Python tool designed to make code search more efficient and developer-friendly.

What is Dynamic File Content Searcher?

Dynamic File Content Searcher is a command-line tool that helps developers search through their project files for specific content patterns. What sets it apart is its ability to recognize various programming patterns, particularly in PHP, Laravel, and HTML files. The tool provides context-aware searching with features specifically designed for web development projects.

Key Features

  • Smart Pattern Recognition: Automatically searches for different variations of your search term, including:
    • Standalone words
    • Content between HTML tags
    • Blade template variables
    • PHP echo statements
    • HTML attributes
    • PHP variables
    • Debug statements
    • And more!
  • Configurable Search Parameters:
    • Customize which folders to skip
    • Define which file extensions to search
    • Easy-to-modify search settings
  • Developer-Friendly Output:
    • Shows context around each match
    • Displays line numbers
    • Saves results in JSON format
    • Progress bar for large projects

 

Installation and Setup

 Install python and after Install the required package:

pip install tqdm
  1. Save the script as searchlone.py in your directory.

How to Use

  1. Run the script:
python searchlone.py
  1. Follow the interactive prompts:
    • Enter the project path you want to search
    • Specify the search term
    • Optionally modify skip folders and file extensions
  2. The tool will:
    • Show progress while searching
    • Display matches with context
    • Save detailed results to a JSON file

Default Configuration

The tool comes with sensible defaults for web development projects:

  • Skip Folders: vendor, node_modules, storage, bootstrap/cache, .git, public/build
  • Supported Extensions: .php, .blade.php, .html

Example Output

When you run a search, you'll see results like this:

? resources/views/welcome.blade.php Pattern: blade_var Line: 15 13: <div class="container"> 14: <h1>Welcome</h1> 15: {{ $searchTerm }} 16: </div> ----------------------------------------

Tips for Effective Searching

  1. Start with specific search terms to avoid too many results
  2. Use the folder skip feature to exclude test or vendor directories
  3. Add custom file extensions if you need to search other file types
  4. Review the JSON output file for detailed analysis

When to Use

This tool is particularly useful when:

  • Refactoring large codebases
  • Looking for hardcoded strings
  • Auditing template variables
  • Searching for specific PHP patterns
  • Finding HTML content across multiple files

Performance and Large Projects

The tool is optimized for performance with:

  • Progress tracking for large file sets
  • Efficient file handling
  • Clear progress indicators
  • Skip patterns for common large directories

Conclusion

Dynamic File Content Searcher is a valuable addition to any developer's toolkit, especially those working with PHP, Laravel, or HTML projects. Its smart pattern recognition and context-aware searching make it more powerful than standard text search tools.

 

Try it out and see how it can improve your development workflow!

Get it from github by clicking here!

Share post
You must be logged in to post a comment
Top