Skip to content

A library to parse terminal escape sequences (almost) exactly how the real hardware does.

License

Notifications You must be signed in to change notification settings

danielgatis/go-vte

Repository files navigation

go-vte

Go Report Card License MIT Go Doc

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.

Install

go get -u github.com/danielgatis/go-vte

And then import the package in your code:

import "github.com/danielgatis/go-vte"

Example

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

License

Copyright (c) 2020-present Daniel Gatis

Licensed under MIT License