tarka / xcp

An extended `cp`
GNU General Public License v3.0
746 stars 24 forks source link

Add --no-perms option to skip setting permissions #10

Closed lnicola closed 4 years ago

lnicola commented 4 years ago

Fixes #9.

tarka commented 4 years ago

Hi,

Thanks for the PR. I'm happy to merge this feature, but it can be improved a bit first. I'm not keen on using bare bools as flags here, as we'll probably be adding more flags for similar options (e.g. xattrs). It would be better to pass the Opts down to the low-level functions and let them access the flags as needed.

To help with this I've made some modifications to support passing Opts about, including moving to scoped threads (which I've been procrastinating for a bit anyway). I've also modified copy_file to give it access to the Opts structure,so this can be used there now. Can I ask you to update you PR with the following:

Thanks, Steve

lnicola commented 4 years ago

Sure, sorry for taking the easy way out there. I rebased the PR and updated it with your suggestions (not sure why I missed the set_permissions call in parblock the first time). There are some slight formatting differences in the diff, if you find it unreadable I can split them to a different commit (or leave them out entirely, or run cargo fmt against the whole project).

tarka commented 4 years ago

Awesome, thanks.

tarka commented 4 years ago

BTW, I'll probably release this at the weekend.