Giter Site home page Giter Site logo

vt-command's Introduction

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

vt-command's People

Contributors

nangcr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.