diff --git a/gotansi/gotansi.go b/gotansi/gotansi.go new file mode 100644 index 0000000..80769db --- /dev/null +++ b/gotansi/gotansi.go @@ -0,0 +1,29 @@ +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) + } +}