added ansi example
This commit is contained in:
parent
c079a800f6
commit
410099e314
29
gotansi/gotansi.go
Normal file
29
gotansi/gotansi.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user