vt-command

command module
v0.0.0-...-f2abd3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2022 License: MIT Imports: 3 Imported by: 0

README

vt-command

Go Report Card License MIT Go Doc

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

Use as a CLI tool:
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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL