-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Check dir supplied to copier
exists before going through questions
#1497
Comments
That's pretty much implied by the first example:
I don't think adding troubleshooting notes early in the README is a good idea, but I'm not opposed to it either. Maybe Copier could instead output a useful error message when the destination directory is read-only. |
+1 for the read-only error! You end up with a regarding docs: I submitted some text in #1498 that I think should flag it minimally in the README, and a little more explicitly in the template generation page. |
I don't think this is a good idea. In case you run copy over a preexisting dir, copier will copy on it, just like it should do. If the dir happens to be a git-tracked template that contains an answers file, you can use copy as a recopy alternative. Sometimes an upstream template lacks some patches, then you need to use a downstream template with those patches and you need to change the origin of the template. The only official way to do that is to issue a copy command over a preexisting template. Let me close this request because it breaks expected behaviours, just to keep the issue tracker clean. But you can keep commenting if you want 😉 |
@yajo the suggestion was to handle the case where the destination directory already exists but is read-only, meaning Copier will never be able to write into it (be it for an update or a recopy). But after actually testing this out, it seems we already get a |
Actual Situation
One may accidentally run a
copier copy
command without making a new directory first if that's desired.Desired Situation
I'd want the dir to be created for me, or an error message that comes up telling me the dir doesn't exist before filling in the template.
Proposed solution
Should be a pretty simple check to make, happy to open a PR for this.
Couldn't find this issue documented anywhere, so apologies if this is already supported with a flag or asked elsewhere.
edit: after playing around, I can see that the creation behavior is what happens (but errored on a particular string if the directory is read-only, e.g.
/path/to/dir
). Happy to close this, but I'd probably like it documented somewhere fairly early in the README that this is what happens!The text was updated successfully, but these errors were encountered: