A toy codebase for trying out AST-based refactoring. Run these from the repo root.
cargo run -- replace -i -p 'debug($msg)' -r 'logger.warn($msg)' examples/java/UserService.java
cargo run -- find -p 'user.$method($($thing),*)' examples/java/UserService.javacargo run -- replace -i -p 'print($msg)' -r 'logger.info($msg)' examples/python/api.py
cargo run -- find -p 'logger.info($msg)' examples/python/api.pyTo delete prints entirely:
cargo run -- delete -i -p 'print($msg)' examples/python/api.pycargo run -- replace -i -p 'const {$a, $b} = $obj' -r 'const {$b, $a} = $obj' examples/javascript/app.jscargo run -- find -p 'console.log($a, $b)' examples/javascript/app.js
cargo run -- find -p 'return $val;' examples/java/UserService.java
cargo run -- find -p 'print($msg)' examples/python/api.pyAll the -i commands modify files in-place. If something goes wrong:
git checkout examples/