Replies: 2 comments 4 replies
-
Thanks for trying out ast-grep! To use the rule on command line, you need first save it in a yaml and add other related fields like Then you can use the command line to search your code. ast-grep scan -r myrule.yml |
Beta Was this translation helpful? Give feedback.
-
@HerringtonDarkholme Great tool! I'm loving it. I have a similar situation, where I want to create a capture group and refernce it in the the fix section. Basically, I want to transform:
to:
I have the rule that finds what I need, but I can't figure out how to reference the capture group.
Any suggestions? Thank you! |
Beta Was this translation helpful? Give feedback.
-
This tool looks amazing. I am trying to use cases of the top of my head and one was: find all update() functions called on an object whos name contains "coll".
something Iike
ast-grep --lang js --pattern '[*coll*].update($$$)'
and would match
userColl.update(...)
andclientCollection.update(...)
where the part in
[]
would be a regex matcher, maybe it could be capturing too with$META_NAME
. Is this possible?Beta Was this translation helpful? Give feedback.
All reactions