pkg/term

Expose ability to modify arbitrary terminal attibutes via Term struct

Opened this issue · 1 comments

Currently, if I use the github.com/pkg/term package, there is no mechanism to allow a developer to modify arbitrary attributes of a terminal managed by a Term struct. This is unfortunate, since the Term struct exposes some great functionality, and it would be awesome if there where a way to use the Term struct, but manually set the attributes I want.

Why Is SetOption Publicly Exported?

What's odd is that the Term struct does have a method, SetOption, which seems like it would allow a developer to make the manual changes one desires. But SetOption accepts functions which modify Term, but since Term has no exported fields, no function defined outside of this package can access any fields of Term, meaning no externally defined function can make use of SetOption. Since SetOption isn't useful outside of this package (at least as far as I can tell), why is it exported publicly?

I think the quickest change to get the functionality I'm describing would be to make the fields of Term public. Barring that, some other way of manually setting terminal attributes would be awesome!

This package follows Rob Pike's functional options pattern. If there is a particular option you want to see added to this package, please raise it as a request or send a pull request.