PSReadLine: Make the output of script block handler formatted and rendered to the console?
When using programs(less
, fzf
etc.), that emit to alternate buffers, inside ScriptBlock
, there is no display of the program buffer.
For Eg:
Set-PSReadLineKeyHandler -Chord Ctrl+o -ScriptBlock { less foo.txt }
Set-PSReadLineKeyHandler -Chord Ctrl+o -ScriptBlock { find . | fzf }
Show no output
Couple of questions a) Why is that? b) What should I do if I need to display them? (Start separate process and redirect stdout from that process?)
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 15 (11 by maintainers)
Hmm, PSFzf doesn’t want to play nice for me under linux under PowerShell Core 7 and I think that it would be awesome if interactive scripts could be invoked using hotkeys, so I would appreciate if this issue could be solved in a way that doesn’t require external tools.
Edit: Hmm, it seems like I’ve managed to solve it for now, but this doesn’t seem to be the cleanest workaround:
Yes, I guess I was hinting that you’d have to return, but a function like
AcceptAndGetNext
could be used to restore the current input.