sd
sd copied to clipboard
[Feature request] Verbose mode
Firstly, thanks for making and sharing this tool. I find it really intuitive to use!
Sometimes I'll mess up a regex, misspell a word, or am too general with a regex and will modify the file in a way I didn't expect. I find myself wishing there was some way to signal the impact of my command without having to open up the file and find out later. Something like a verbose mode -v like in clis such as mv, cp, etc. That way the user gets immediate feedback.
% sd -v 'old' 'new' file.txt
Replaced 3 instances of "old" with "new" in file.txt
% sd -v 'old' 'new' file3.txt
Replaced 0 instances of "old" with "new" in file3.txt
% sd -v 'new' 'really_new' *.txt
Replaced 2 instances of "new" with "really_new" in file1.txt
Replaced 1 instances of "new" with "really_new" in file2.txt
Replaced 0 instances of "new" with "really_new" in file3.txt
Is the --preview flag what you want or you have something more specific in mind