Re: [PATCH] Add --stowdir and --delete options to chkstow
Adam Spiers <[email protected]> Sun, 28 Feb 2016 13:35:33 +0000
| Newsgroups | gmane.comp.gnu.stow.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Feb 11, 2016 at 06:40:10PM +0100, [email protected] wrote: > Hello, >=20 > I use GNU stow to manage my dotfiles and I love it. Great! Me too :-) As an aside, did you see this which I linked from the homepage? http://lists.gnu.org/archive/html/info-stow/2011-12/msg00000.html > The only thing I missed was > a way to remove leftover symlinks whenever I removed a file in my dotfi= les > repository. You can achieve this simply by restowing a package: stow --restow > When I looked at the source to find out how easy it might be to impleme= nt what I > needed, I stumbled upon chkstow (Which I had not heard of before =E2=80= =93 A quick > search tells me it=E2=80=99s not even mentioned in the man page) which = was almost > exactly what I looked for. >=20 > However, it prints every single symlink that points to non-existing fil= es, even > though I only care about those files that point to non-existing files i= n my stow > directory (ie. my dotfiles repository). Since the target is my home di= rectory, > there=E2=80=99s lots of garbage, abandoned projects, etc. lying around = which contain > stale symlinks. >=20 > To accomplish my goals (which I hope are shared by others, hence I=E2=80= =99m writing > this mail), I added the following command line options: >=20 > * --stowdir: Sets the stow directory, so chkstow can determine whether = a path is > inside it, in order to ignore symlinks that point to outside of it. = By > default, this value is set to "/", to stay backwards compatible =E2=80= =93 this way no > symlink will be ignored except if you supply this option. >=20 > * --delete: Makes chkstow delete all the =E2=80=9Cbogus symlinks=E2=80=9D= it discovers. >=20 > Both changes are attached as seperate patches to this email. Feel free= to tell > me what I did wrong, since this is the first snippet of perl code I wro= te in my > whole life. That sounds very promising, thanks! Any chance you could submit as a pull request to https://github.com/aspiers/stow ? Cheers, Adam