tomnomnom / gf

A wrapper around grep, to help you grep for things
MIT License
1.81k stars 317 forks source link

Suggestion: Add JavaScript `debugger` flag to debug-pages #8

Open gsilvapt opened 5 years ago

gsilvapt commented 5 years ago

If one wants to use this tool to debug a code base, it would be helpful to find the debugger flag in a JavaScript/NodeJs framework.

I know I can fork and add whatever patterns I like but I want to know if this pattern is actually useful or if it could just make the program run slower overall.

What do you think, @tomnomnom?

Jab2870 commented 5 years ago

You could add a file called someting like debugger.json to your ~/.gf/ folder with a contents like this:

{
    "flags": "-HnraiE",
    "pattern": "^\\s*debugger;"
}

You could then use it with gf debugger

The pattern here matches the string debugger; if it is proceeded only by white space on the line.

gsilvapt commented 5 years ago

I think my idea with this issue was to discuss whether or not exploring Node debuggers was useful. I could that, absolutely (and my config currently has a regex in the javascript files). But would it be useful?

tomnomnom commented 5 years ago

Hey!

I think on balance adding a debugger.json pattern as @Jab2870 suggests is probably the better idea IMO. My debug-pages pattern is really about finding debug/error pages in the output of meg etc.

Thanks!

gsilvapt commented 5 years ago

Thanks for the explanation. I added that to my fork because it might be useful to me.