facebookincubator / fastmod

A fast partial replacement for the codemod tool
Apache License 2.0
1.66k stars 41 forks source link

Allow deletion #32

Closed sluongng closed 2 years ago

sluongng commented 3 years ago

when I was trying to remove a matched set of configurations, I realized that fastmod default replacing the config with an empty line instead:

fastmod 'some-matching-config.*\n.*\n.*\n' ''

It would be nice to have a --delete flag that, instead of replacing existing matches with an empty line, it would just delete the matching lines.

swolchok commented 3 years ago

Fastmod doesn't try to insert extra lines, it just does the replacement you specify. Couple potential fixes: 1) Did you try the -m option? 2) Perhaps you needed to match and remove one extra newline character?

swolchok commented 2 years ago

closing because there has been no reply for almost 1 year; feel free to reply and reopen if my suggestions did not help