-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Replace many lines in a file #163
Comments
Hi @gedw99! No, there isn't currently a way to do a multi-line replace. The I hope it can still be useful in some way, though. |
Thanks I Kind o worked out a way by round tripping the line number throughout the event loop. So i just need to hold that line number at the Context level and so the Actor is charge of the file system knows where to inject the file change. I also thought if using go-git but it’s YAGNI I think. When many clients I keep all client up to data in real time with what data maps to what kind so I avoid clashes. If 2 clients are editing the same line I can do inner lines diff / replace in real time. ohhh it’s a complicato !! Poor man’s OT / CRDT … I worked out that the JSONLines spec is a pretty good match if working with json. everythibg worth their salt supports it . some of this might be refactorable into a Upstream PR, if your into the idea .. |
Actually there is a really easy way to do this currently.
This is a very simple example, the point is modline is a function and that function can be as complex as you need it to be, and whatever is returned from that function gets written to the file. The match / regexp gives me that block of multiple lines out of the file. |
Love this project t - thanks for doing it.
Is there a formal way of replacing many consecutive lines in a file ?
There seems to only the ability to replace single lines?
My uses case is needing to edit a file . I have a cli and gui that first copies every line of a file to the clients and holds each line in memory. Then as the user edits a line or a collection of lines and the changes are sent to be replaced in the file.
An interesting side aspect is that the user could also manually edit the file , so I also need to tail the file and send chsnged lines to the cli and gui , so the clients sone get out of sync.
I don’t think there is a formal tail command ?
The text was updated successfully, but these errors were encountered: