Ignore directories in stow

Rudra Banerjee <[email protected]> Thu, 30 Apr 2020 06:35:47 +0000
Newsgroups gmane.comp.gnu.stow.general
Message-ID <AM5P190MB027695BA9B9FA7D8839A2064E9AA0@AM5P190MB0276.EURP190.PROD.OUTLOOK.COM>
--_000_AM5P190MB027695BA9B9FA7D8839A2064E9AA0AM5P190MB0276EURP_
Content-Type: text/plain; charset="koi8-r"
Content-Transfer-Encoding: quoted-printable

Hi all,
I am relatively new in stow (using for last 6 months). While this is workin=
g fine for backing up my config files, it is actually storing unwanted file=
s, and not obeying my .stow-local-ignore.

I am using a script to install stow all my stowed files:
cat ~/bin/stow.sh
#!/usr/bin/env bash

# This script will Stow all the dotfiles located in the ~/dotfiles folder.
# The -R flag is used to force a 'restow' which will remove any existing sy=
mlinks before attempting to Stow.

echo "Stowing Dotfiles...";

cd ~/Utility/configs
for file in *; do
  # Only run Stow on the directories in the dotfiles folder and not the ind=
ividual files.
  # Using 'basename' strips the filepath from the directory name.
  if [ -d ${file} ]; then
    stow  $(basename $file) -t ~/
    echo "$(basename $file) stowed.";
  fi
done

# Return back to the your PWD from before you ran the script
cd ~-

echo 'All stowed';


Now, among many stowed files, lets take the example of vim: The path is:
~/Utility/configs/vim  which has the structure:
tree -a -L 2
.
=86=80=80 .stow-local-ignore
=86=80=80 .vim
=81   =86=80=80 autoload
=81   =86=80=80 plugged
=81   =86=80=80 spell
=81   =84=80=80 UltiSnips
=84=80=80 .vimrc


But, inside .vim, I don't want plugged and spells to be stowed, so, I have =
.stow-local-ignore:
 cat .stow-local-ignore
\.vim/plugged
\.vim/spell


But this is not working.  I have actually deleted those unwanted dir's and =
unlinked ~/.vim and restowed, but this does not work. As soon as those file=
s are generated inside ~/.vim, it is stowed.

How I ignore them?

Kindly help.

--_000_AM5P190MB027695BA9B9FA7D8839A2064E9AA0AM5P190MB0276EURP_
Content-Type: text/html; charset="koi8-r"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dkoi8-r">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Hi all,</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
I am relatively new in stow (using for last 6 months). While this is workin=
g fine for backing up my config files, it is actually storing unwanted file=
s, and not obeying my .stow-local-ignore.</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
I am using a script to install stow all my stowed files:</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<span><i>cat ~/bin/stow.sh <br>
</i></span>
<div><i>#!/usr/bin/env bash<br>
</i></div>
<div><i><br>
</i></div>
<div><i># This script will Stow all the dotfiles located in the ~/dotfiles =
folder.<br>
</i></div>
<div><i># The -R flag is used to force a 'restow' which will remove any exi=
sting symlinks before attempting to Stow.<br>
</i></div>
<div><i><br>
</i></div>
<div><i>echo &quot;Stowing Dotfiles...&quot;;<br>
</i></div>
<div><i><br>
</i></div>
<div><i>cd ~/Utility/configs<br>
</i></div>
<div><i>for file in *; do<br>
</i></div>
<div><i>&nbsp; # Only run Stow on the directories in the dotfiles folder an=
d not the individual files.<br>
</i></div>
<div><i>&nbsp; # Using 'basename' strips the filepath from the directory na=
me. <br>
</i></div>
<div><i>&nbsp; if [ -d ${file} ]; then<br>
</i></div>
<div><i>&nbsp; &nbsp; stow &nbsp;$(basename $file) -t ~/<br>
</i></div>
<div><i>&nbsp; &nbsp; echo &quot;$(basename $file) stowed.&quot;; <br>
</i></div>
<div><i>&nbsp; fi<br>
</i></div>
<div><i>done<br>
</i></div>
<div><i><br>
</i></div>
<div><i># Return back to the your PWD from before you ran the script<br>
</i></div>
<div><i>cd ~- <br>
</i></div>
<div><i><br>
</i></div>
<div><i>echo 'All stowed';</i><br>
</div>
<span></span><br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Now, among many stowed files, lets take the example of vim: The path is:</d=
iv>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
~/Utility/configs/vim&nbsp; which has the structure:<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<span>tree -a -L 2<br>
</span>
<div>.<br>
</div>
<div>=86=80=80 .stow-local-ignore<br>
</div>
<div>=86=80=80 .vim<br>
</div>
<div>=81&nbsp;&nbsp; =86=80=80 autoload<br>
</div>
<div>=81&nbsp;&nbsp; =86=80=80 plugged<br>
</div>
<div>=81&nbsp;&nbsp; =86=80=80 spell<br>
</div>
<div>=81&nbsp;&nbsp; =84=80=80 UltiSnips<br>
</div>
<div>=84=80=80 .vimrc<br>
</div>
<span></span><br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
But, inside .vim, I don't want plugged and spells to be stowed, so, I have =
.stow-local-ignore:</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<span>&nbsp;cat .stow-local-ignore <br>
</span>
<div>\.vim/plugged<br>
</div>
<div>\.vim/spell<br>
</div>
<span></span><br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
But this is not working.&nbsp; I have actually deleted those unwanted dir's=
 and unlinked ~/.vim and restowed, but this does not work. As soon as those=
 files are generated inside ~/.vim, it is stowed.&nbsp;</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
How I ignore them?</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Kindly help.</div>
</body>
</html>

--_000_AM5P190MB027695BA9B9FA7D8839A2064E9AA0AM5P190MB0276EURP_--