参考
https://github.com/ast-grep/ast-grep
概要
さまざまな言語で字句解析をした上で、文字列検索や置換ができる。
例えば、
console.log(1,2,3)
などを
sg --pattern 'console.log($$$ARG)' --rewrite 'logger.log($$$ARG)' --lang ts
のように置換できる。
インストール
公式のページのインストール方法でも良いし、公式の releases からダウンロードしてPATHを通すだけでもよい
https://github.com/ast-grep/ast-grep/releases
[通知用URL]
Tweet
最終更新時間:2026年03月11日 21時06分10秒