Change uiutil from survey to pterm#4853
Conversation
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
liketosweep
left a comment
There was a problem hiding this comment.
Really glad to see this moving forward survey being archived was a pain point worth addressing.
A few things I noticed while looking through the diff that might be worth considering:
- The two failing QEMU integration tests feel related to
go-isattybeing removed from the imports.surveyused it for explicit TTY detectionptermmay not handle non-TTY stdin (containers, piped input, SSH without a PTY) as gracefully, which could explain the failures. Might be worth a quick TTY check before invoking any interactive prompt. ptermbrings in quite a few more transitive dependencies compared tosurvey. Not necessarily a problem, just something to be mindful of from a binary size and supply chain perspective.
On the suggestion side it might be nice to expose a defaultValue bool parameter on ConfirmInput down the line. survey had this and it's handy for callers who want a sensible fallback in automated or scripted workflows without blocking on user input.
None of this is a criticism the public API is preserved cleanly and the interrupt handling via OnInterruptFunc is genuinely an improvement over what was there before. Just flagging in case any of it is useful!
|
Sorry, but that does not seem to be matching the code? The github.com/mattn/go-isatty mod is unchanged... There is no significant change in the binary size: There is no method called The interrupt function is a bit of a workaround to return |
|
Thanks for the corrections, @afbjorklund. I definitely misread the |
Closes #1881