Anyone working on implementing ':r! cmd' for the vi applet?
Jason Pena
jasonpena at awkless.com
Mon Feb 12 18:34:17 UTC 2024
Hello, is anyone currently working on implementing ':r! cmd' for the vi applet?
If not, then I have a simple plan to implement ':r! cmd' with some basic
work-in-progress code.
In general, by altering "read" in colon() to use popen() to open a pipe to
process the shell command. Then use fgets() to get the output of the shell
command to a buffer that can then be inserted into the current edit buffer using
string_insert().
I think the only real issue is deciding whether or not to use a new flag to
determine when the user chooses to use ':r file' instead of ':r! cmd'. The
"useforce" flag would not make a lot of semantic sense. Hence, why the test code
I have uses a new variable called "variant" to distinguish between ':r file' and
':r! cmd'.
All in all, let me know if anyone is already doing this, or to convert my
work-in-progress code into a full feature patch submission.
More information about the busybox
mailing list