30 lines
478 B
Go
30 lines
478 B
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
|
|
"github.com/rivo/tview"
|
|
)
|
|
|
|
func main() {
|
|
app := tview.NewApplication().
|
|
EnableMouse(true)
|
|
|
|
textView := tview.NewTextView().
|
|
SetDynamicColors(true).
|
|
SetChangedFunc(func() {
|
|
app.Draw()
|
|
})
|
|
textView.SetBorder(true).SetTitle("Stdin")
|
|
go func() {
|
|
w := tview.ANSIWriter(textView)
|
|
if _, err := io.Copy(w, os.Stdin); err != nil {
|
|
panic(err)
|
|
}
|
|
}()
|
|
if err := app.SetRoot(textView, true).Run(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|