File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ type In struct {
1515 in io.ReadCloser
1616}
1717
18+ // NewIn returns a new [In] from an [io.ReadCloser].
19+ func NewIn (in io.ReadCloser ) * In {
20+ i := & In {in : in }
21+ i .fd , i .isTerminal = term .GetFdInfo (in )
22+ return i
23+ }
24+
1825// Read implements the [io.Reader] interface.
1926func (i * In ) Read (p []byte ) (int , error ) {
2027 return i .in .Read (p )
@@ -47,10 +54,3 @@ func (i *In) CheckTty(attachStdin, ttyMode bool) error {
4754 }
4855 return nil
4956}
50-
51- // NewIn returns a new [In] from an [io.ReadCloser].
52- func NewIn (in io.ReadCloser ) * In {
53- i := & In {in : in }
54- i .fd , i .isTerminal = term .GetFdInfo (in )
55- return i
56- }
Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ type Out struct {
1515 out io.Writer
1616}
1717
18+ // NewOut returns a new [Out] from an [io.Writer].
19+ func NewOut (out io.Writer ) * Out {
20+ o := & Out {out : out }
21+ o .fd , o .isTerminal = term .GetFdInfo (out )
22+ return o
23+ }
24+
1825func (o * Out ) Write (p []byte ) (int , error ) {
1926 return o .out .Write (p )
2027}
@@ -44,10 +51,3 @@ func (o *Out) GetTtySize() (height uint, width uint) {
4451 }
4552 return uint (ws .Height ), uint (ws .Width )
4653}
47-
48- // NewOut returns a new [Out] from an [io.Writer].
49- func NewOut (out io.Writer ) * Out {
50- o := & Out {out : out }
51- o .fd , o .isTerminal = term .GetFdInfo (out )
52- return o
53- }
You can’t perform that action at this time.
0 commit comments