loreanvictor / tmplr

Automate Code Scaffolding
MIT License
26 stars 0 forks source link

`copy` should allow `to: .` as the destination #33

Open fwextensions opened 9 months ago

fwextensions commented 9 months ago

I tried doing something like this:

  - copy: tmp/README.md
    to: .

But it looks like tmplr was trying to replace the local directory with the file. I'd expect that specifying a path, even just ., would copy the file to that location using its existing name.

I guess there's some ambiguity as to whether ./foo should mean renaming the file to foo or not. I feel like there's some de facto standard in configs like for webpack, but I can't think of it at the moment.

In any case, it would be nice to catch the error and provide a better message than illegal operation on a directory, since I didn't think I was doing anything to a directory.