feat: support Stderr for interactive text inputs#529
feat: support Stderr for interactive text inputs#529lammel wants to merge 11 commits intopterm:masterfrom
Stderr for interactive text inputs#529Conversation
|
With this PR using interactive inputs on STDERR will be possible and also required adjustments for changes with atomicgo/cursor#17 are applied. This is ready for review now. |
|
Hi @lammel, it seems like this branch doesn't build: |
|
Oh, I guess this requires the new cursor updates. |
|
Cursor received the update |
Codecov Report
@@ Coverage Diff @@
## master #529 +/- ##
==========================================
- Coverage 82.27% 81.66% -0.62%
==========================================
Files 30 30
Lines 3510 3539 +29
==========================================
+ Hits 2888 2890 +2
- Misses 564 591 +27
Partials 58 58
|
Done! Should we add an example for Stderr too? So this is ready to merge now! (squash highly recommended) |
Stderr (io.Writer) for interactive text inputs
Stderr (io.Writer) for interactive text inputsStderr for interactive text inputs
|
Awesome! But I am a little torn apart, that some printers require I am not sure, what the best way would be, to make the area accept Maybe we could implement a type Buffer struct {
*bytes.Buffer
}
func NewBuffer() *Buffer {
return &Buffer{new(bytes.Buffer)}
}
func (b *Buffer) Fd() uintptr {
return 0
}
func main() {
buf := NewBuffer()
res, _ := pterm.DefaultInteractiveTextInput.WithWriter(buf).Show("Input")
pterm.Info.Println(res)
}Then we could require We could migrate the other printers to |
The multi-progressbar example looks great!
Maybe we should take another look at cursor if we can support Windows without requiring syscalls and hence the Fd(). We might take a closer look at https://github.com/gdamore/tcell which supports Windows by using a pure Go terminfo implementation with reasonable performance and good compatibility. This would allow to stick with a simple
So breaking for all code that is using
Let's see where the discussion heads and continue then. |
|
Hi, sorry for the delay..
Sadly we cannot switch to a pure Also, we want to make PTerm as compatible as possible, there are many great TUI libraries out there, but we found PTerm to be one of the most cross-platform ones. I think the custom buffer idea might not be that bad. Also I worked on #544, which will most likely be merged today. It currently uses But I am open to different approaches, maybe we can stick to |
|
Guess we have to decide on the approach first before I can continue here. |
|
Hi @lammel, is there any update for this feature? It's really sad the progress bar works only with one io.Writer. If you create a |
|
Hi @k-poppe, I don't think @lammel can really continue on this at the moment. He already did a great job, but I do have to make a design decision that I didn't have time to do, yet. I want to continue with PTerm in the next year, as my daily work is now much more organized than the last couple of months. Sorry for the long wait! |
Don't worry, I pretty much ran out of any remaining spare time in the last couple of months too. |
|
Its been almost 2 years, is this going to be worked on? |

Description
This PR adds support for handling interactive text inputs in combination with Stderr.
The work is based on PR atomicgo/cursor#17 for
atomicgo/cursorwhich allows cursor handling on a custom writer.This PR is in DRAFT state, created to allow referencing in the cursor PR.
Scope
All interactive text inputs are affected.
Related Issue
To-Do Checklist