[x/term] Adding history save/restore/clear/etc and some small issues

75 views
Skip to first unread message

Dragos Vingarzan

unread,
Jun 6, 2024, 7:54:41 PMJun 6
to golang-nuts
Hey folks,

I recently embedded the golang.go/x/term into my application and I love the simplicity and effectiveness of having such a terminal.

The history part of it is also great to have, but even better if one could save/restore the history over application restarts. I did some changes and a proof-of-concept and I'm wondering if this would be worth merging. So any developers/maintainers/users here which I could maybe ping ideas with, before submitting a patch for review?

I also found a couple of slightly annoying issues which I'd also like to fix:
1. Terminal.ReadPassword() allows the auto-complete callback; I don't see why that would be helpful, other than making TABs harder to use in passwords :-p. Of course, once could simply unset/set the callback around the calls to Terminal.ReadPassword(), but feels like I shouldn't need that (e.g. some users might leak partial password unintentionally).
2. I redirected all my stdout logs through Terminal.Write(), but still, I'm getting some funky wrapped lines when (I guess) my go-routines write things in parallel or maybe when the prompt is "refreshed"... not sure.

Cheers,
-Dragos 
Reply all
Reply to author
Forward
0 new messages