tarka / xcp

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

Support for no-target-directory and hidden files #6

Closed hwchen closed 5 years ago

hwchen commented 5 years ago

A PR for some features that would be helpful to me. Feel free to close if these are not desired. I'm also happy to make changes.

closes #5

Commit Message:

add option for no-target-director, analagous to cp's no-target-directory. Expected behavior is that when copying a directory to another directory, instead of creating a sub-folder in target, overwrite target.

add option for hidden files. Default is to ignore hidden files.

This is a little hacked in; it seems as though ignore's Walk could handle both .gitignore and hidden files on its own, but I may have missed something.

tarka commented 5 years ago

Thanks for the PR. I'll try and take a look at it this weekend.

tarka commented 5 years ago

Hi Walther,

The target-directory patch looks useful. Can you split it out into another PR and add a test?

I'm not sure about the git hidden files one. I can't reproduce the issue, but expanded the gitignore test to cover the case.

Thanks, Steve

hwchen commented 5 years ago

Great, I'll split out the target-directory stuff and take a look at the hidden files test.

I wasn't very clear about the .gitignore and hidden files issue. I wanted a patch that would allow me to specify not copying hidden files; in this PR I had set ignoring hidden files as the default, which I probably shouldn't have.

My use case is copying a folder without the .git directory.

Let me know if you think it would be ok to add a flag to ignore hidden files/dir.