A GO version of https://github.com/alacritty/vte.
The pkg vtparse
implements a state machine that mirrors the behaviour of DEC (Digital Equipment Corporation) VT hardware terminals. The state machine was originally described by Paul Williams; more information can be found here: http://www.vt100.net/emu/dec_ansi_parser.
go get -u github.com/danielgatis/go-vte
And then import the package in your code:
import "github.com/danielgatis/go-vte"
Please look at: examples/parserlog/main.go
❯ echo -ne "Hello\nWorld" | go run ./examples/parserlog/main.go
[Print] H
[Print] e
[Print] l
[Print] l
[Print] o
[Execute] 0a
[Print] W
[Print] o
[Print] r
[Print] l
[Print] d
Copyright (c) 2020-present Daniel Gatis
Licensed under MIT License