New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy separate file, with possible new name #6
Comments
About |
Sure, if |
A nice-to-have feature, especially for npm scripts. But a directory check reminds me of nonpreemptive batch processing and may cause unpredictable results in gulp or similar contexts, e.g.:
Similar problems may arise in the following use cases:
I could imagine some more flexible solutions for this problem: cpy package.json --replace $npm_package_name-$npm_package_version.json Build/ // or --rename
cpy package.json -r $npm_package_name-$npm_package_version.json Build/ // flag style This may also allow us to provide the following in the future: cpy --regex '/image\(.*\).jpg/' --replace '$1.jpg' 'images/image*.jpg' assets |
I would love this flexibility! Right now I have separate npm scripts for single files. Rename might me a better name, as nothing is replaced. |
My first idea was |
@kevva Thoughts on this? |
One use-case I've found is not very intuitive: # this won't work:
$ cpy src -r dest
# but this:
$ cpy src -r dest . |
This doesn't look valid. ? |
@sindresorhus: that is handled by meow, or more precisely minimist.
> meow({ argv:['src', '-r', 'dest', '.'] });
{ input: [ 'src', '.' ],
flags: { r: 'dest' },
…
} |
Good point. I'd say PR welcome on this. I prefer |
Works like a charm. Thank you very much @schnittstabil. |
I'd like to copy an existing file to a new path, with a possible new name. The idea would be something like
I think we would need an option for that. Or we could check for a trailing slash, like
cp
does. I would prefer the later one, I'm not sure if that's a good idea because it might break existing use cases.The text was updated successfully, but these errors were encountered: