Open Suika opened 3 years ago
You can do this now via:
$ rmlint -o sh -c sh:cmd='echo "symlinking to original $2" && rm -rf "$1" && ln -s -r "$2" "$1"'
Or we could add an option like rmlint -c sh:symlink -c sh:relative
Pretty sure -c sh:relative
is less prone to problems and easer to comprehend than the other thing you wrote out. Mess sh:cmd=
up and things could go wrong.
I noticed that rmlint only does absolute links due to the way the files are passed to the link executable. It would be nice to have the ability to set a flag, that will create relative links. ie.
ln -s -r
. https://github.com/sahib/rmlint/blob/master/lib/formats/sh.sh#L176 If that option is set, ln will not create an absolute path and will find the shortest way to the target.I think I saw an issue that fixed the lookup of the symlinks that contain relative paths, so this should be safe. Well, I can always edit the generated rmlint.sh and it will work due to the proper way rmlint references and uses the commands.