Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Automatic stdout/err redirection
On 11 Nov 2017 at 16:12:54, Yuri D'Elia (wavexx@xxxxxxxxxx) wrote:
> I've been thinking for a while about the ability to manipulate the
> output of the previous command without executing it again. It's such a
> common occurrence...
>
> Imagine the following desired behavior:
>
> - when executed interactively, each cmdline redirects the stdout to some
> temporary $FILE in _addition_ to stdout
> - we want to fool the pipeline into thinking that stdout is still a TTY
> and disable buffering (I don't want any change in regular command
> behavior)
> - stdout though is not directly flushed to the pty, it's actually
> filtered by something inbetween like "head -25" that shows the first
> 25 lines only, and then shows a message "truncated output" when this
> occurs, without flooding the terminal
> - the full output is still available in $FILE
I've tried to approach this. I think it would require additional process to accumulate the screen data, at least when adding to current Zsh. It is somewhat doable, even with fullscreen programs, because it can currently be done with Tmux:
https://blog.plenz.com/2012-01/zsh-complete-words-from-tmux-pane.html
So at least the most straightforward use cause – complete words from screen – is doable. This hints that what would have to be built into Zsh is a terminal multiplexer.
Nevertheless I've also tried with Zsh script code:
https://github.com/psprint/ztrace
This isn't a successful plugin because of the fullscreen issues, but it explores the topic, I think.
--
Sebastian Gniazdowski
psprint /at/ zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author