vt-command
A GO library for parse terminal command with ANSI escape code sequence to human-readable text.
The pkg cmdparser
implements a dispatcher that can dispatch byte of input and finally parse to human-readable text for audit.; more information can be found here: http://www.vt100.net/emu/dec_ansi_parser.
NOTE: This library is still in development.Only support few ANSI escape code sequence now.
Install
go install github.com/nangcr/vt-command
Then
echo -e '<YOUR STRING>' | vt-command > output.txt
Use for development
go get -u github.com/nangcr/vt-command
And then import the package in your code:
import "github.com/nangcr/vt-command/cmdparser"
Example
An example described below is one of the use cases.
package main
import (
"fmt"
"github.com/nangcr/vt-command/cmdparser"
"strings"
)
func main() {
d := cmdparser.NewDispatcher()
err := d.Write(strings.NewReader("mysql> show databases;\u001B[9Gelect 1;\u001B[K"))
if err != nil {
return
}
fmt.Print(d.Flush())
}
mysql> select 1;
License
Copyright (c) 2022-present Nangcr
Licensed under MIT License