deadc0de6 / dotdrop

Save your dotfiles once, deploy them everywhere
https://dotdrop.readthedocs.io
GNU General Public License v3.0
1.77k stars 105 forks source link

[bug] Post action -exec rm {} \; not work as expected #401

Closed roachsinai closed 11 months ago

roachsinai commented 11 months ago

Dotdrop version: v1.13.2 Using dotdrop: AUR archlinux

Describe the bug

Run post actions get error.

Steps to Reproduce

Add below action to config.yaml

actions:
  post:
    remove-backups: find {{@@ _dotfile_abs_dst @@}} -iname '*.dotdropbak' -exec rm {} \;

When run dotdrop install got below error:

[WARN] index error for action: "find /mnt/a/Scoop/persist/ccc -iname '*.dotdropbak' -exec rm {} \;" with "[]": Replacement index 0 out of range for positional args tuple
[ERR] post-action "remove-backups" failed

What's more, change action command to remove-backups: find {{@@ _dotfile_abs_dst @@}} -iname '*.dotdropbak' -delete ; works well.

deadc0de6 commented 11 months ago

I'm guessing the {} from find is somehow confusing the parser (since actions support arguments with {0}, {1}, etc). Can you try with something like the following:

find {{@@ _dotfile_abs_dst @@}} -iname '*.dotdropbak' -print0 | xargs -0 rm 

Also the backup files can be disabled by setting backup to false in the config.

roachsinai commented 11 months ago

Thanks for your quick reply.

find {{@@ _dotfile_abs_dst @@}} -iname '*.dotdropbak' -print0 | xargs -0 rm did works.

I just wanna remove one or two dotfile's backup, like mpv will make warning when found these backup files under scripts folder.