-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add add/import subcommand #142
Comments
@astronouth7303 I really like this idea, but there's some small details to work out. First, is this (approximately) the dance you're referring to?
Second, how clever should it try to be? I think a crude proof-of-concept could be to just have a command do something along the lines of this in # NOTE: This code is untested and incomplete, but I think is in the right ballpark for a proof-of-concept.
# In `emanate.Emanate`:
def add(file): # Can't be called `import` to avoid angering the snek, so I guess we're going with `add`?
file_path = Path(file).expanduser().absolute() # or something like that
dest_path = str(file_path).sub(self.config.source, self.dest) # possibly?
file_path.rename(dest_path) # rename won't clobber existing files afaik. Then, in |
Something to that effect? Assuming you have some knowledge about where the source was |
Oh, and directories are Fun |
When you run So with something like that code above, you could just do
|
I think we should (try to?) ensure the operation is atomic (i.e. either everything got moved and symlinked to the Emanate repo, or nothing changed and we returned with an error) |
I agree. I'm pretty hesitant to add this if it's not atomic, or damn close to it. |
Add a command to quickly & easily import a file into an emanate repo. (Avoiding the dance.)
The text was updated successfully, but these errors were encountered: