Currently writing a CLI application that provides a better wrapper for some Git functionality. As this is a CLI, the user uses their terminal to use the application.
What I need to be able to do is pipe the output of certain commands into "clean" and interactive sub-programs. For example, if the user has my UI up, but presses a key, I need my UI to entirely swap with that of git add --patch [file_name]
. When the user is done (as that is a step-by-step process that eventually concludes) I need to swap back to my application's UI.
Problem is, I don't know where or what to pipe this output to. If I pipe it into the terminal, it clashes with the existing CLI app's stdout
and that does not work.
A separate but related feature was to show diff logs. To solve this issue of a clean and interactive terminal for that, I piped the stdout
into less
and this worked perfectly. Just can't find a way to do that for something more complex like git add --patch
.
Let me know if more details are needed. Mods got grumpy last time when I added (apparently too much) information, so this is super cut down.