HACKER Q&A
📣 DevDevCookies

How to find occurrences of a DB model being used in a monolith?


Hi HN, I'm looking for a way to find any usage of a specific DB model in a monolith - I would prefer to have a tool that scans the files and input/outputs the following:

Input:

- files to scan I.E ["./src", "./test", ...]

- what to scan for I.E ["ExampleModel.", "models.ExampleModel.", ...]

- exclude from scan I.E ["./src/example-folder", ...]

Results:

- From folder: "./src":

        - Number of occurrences: *number*

        - Occurrences: string[] of file paths
- From folder: "./test":

        - Number of occurrences: *number*

        - Occurrences: string[] of file paths
This needs to be something I can write in Javascript or Python. Or preferably if you already know of such a tool please point me to it! :D

Would appreciate any idea, comment or suggestion! Thanks :)


  👤 foothebar Accepted Answer ✓
The existing tool is called `grep`.