Kudos to whoever

... added --plone to ag:

`ag tabular_view parts/omelette/ --plone --follow`

and thanks!

:grinning:

1 Like

I didn't know about "the silver searcher" (try googling for 'ag') not fun.

You can install on Ubuntu/Debian with the following command

sudo apt-get install silversearcher-ag

And it works as @djowett says.

There's a whole plethora of those out there:

Perl:
https://beyondgrep.com/

C:

Go:

Rust:
https://blog.burntsushi.net/ripgrep/

I like the rust one as it works just as well on Windows and seems so far the quickest one.

1 Like

OK I'm going to be lazy and just ask: which version(s) of Plone does that work with? And who added it? :slight_smile:

Nice to see you lurking again @djowett!

Hey @tkimnguyen simples.

the --plone option that I was referring to in ag (the "silver surfer"), just picks out the following file types to search:
.pt .cpt .metadata .cpy .py .xml .zcml

therefore it works with all versions of plone. It faster than grep -r (rgrep) anyway, but limiting it's search to these ploneish source files will speed it up even further. Though I must admit that on benchmarking them now, I do remember grep being a lot slower than this, not sure why....

$ time ag plonetoolbar-workfow-transition  parts/omelette/ --follow --plone
parts/omelette/plone/app/contentmenu/menu.py
689:                'li_class': 'plonetoolbar-workfow-transition'}

real	0m0.309s
user	0m0.090s
sys	0m1.012s
$ time grep -R plonetoolbar-workfow-transition  parts/omelette/
Binary file parts/omelette/plone/app/contentmenu/menu.pyc matches
parts/omelette/plone/app/contentmenu/menu.py:                'li_class': 'plonetoolbar-workfow-transition'}

real	0m0.600s
user	0m0.167s
sys	0m0.429s

Keep up the good work!

1 Like

hmmm... themes now ship with .html files and what about .js files and less files?
I suppose, it is important to be aware of the file types that this selects for.

1 Like

In, but just do something like ag --list-file-types | grep -C 1 html