Closed shenwei356 closed 1 year ago
Please add an option to disable undo, otherwise I need to do an extra step to delete the .brename_detail.txt
file
Safety is the priority of brename
.
An environment variable could be a good way.
BRENAME_DISABLE_UNDO
Dear @shenwei356, creating environment variables is not a portable way to do things. Also a constant fear of doing something wrong is a major obstacle to grow — it shifts responsibility from humans to computers, reinforces personal helplessness and, above all, deprives growing (grown) users of completing advanced tasks.
So please consider adding a couple of switches to mitigate long-irritating features:
C:\DOCS\.tags1 secret internal public
-> rename secret into confidential)Here's my plan:
disable creating .brename_detail.txt
.brename_detail.txt
files in the current or given directory.creating .brename_detail.txt
files.include objects starting with dot
^\.
for skipping file starting with a dot) to set an excluding filter, similar to -F, --exclude-filters
. Adding an extra filter is for backward compatibility.Implemented. Please have a try.
Added examples:
11. disable undo if you do not want to create .brename_detail.txt (-x)
brename -p xxx -r yyy -x
12. clear/remove all .brename_detail.txt files (--clear)
brename --clear -R
13. also operate on hidden files: empty -S (default: ^\.)
brename -p xxx -r yyy -S ""
New options
--clear remove all .brename_detail.txt" file, you may need to add
-R/--recursive to recursively clear all files in the given path
-x, --disable-undo do not create .brename_detail.txt file for undo
-S, --skip-filters strings skip file filter(s) (regular expression, NOT wildcard). multiple
values supported, e.g., -S "^\." for skipping files starting with a
dot, but ATTENTION: each comma in the filter is treated as the
separator of multiple filters, please use double quotation marks for
patterns containing comma, e.g., -p '"A{2,}" (default [^\.])
@shenwei356, I'm relieved to hear that you agreed to implement the requested features for advanced users so quickly. It did feel as though a weight had been lifted off my mind. Happily renaming folders throughout today.
Cheers! If no error or bug is found, I'll release the new version the next day.
It's available here: https://github.com/shenwei356/brename/releases/tag/v2.12.0
.brename_detail.txt
.\t
as the delimiter cause it's legal in path name,_shenwei356-brename_
may better.brename -u
to read the file and reverse the renaming.