Skip to content

veops/go-ansiterm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple VT-compatible Linux Terminal Emulator

Licence Golang


中文

Introduction

go-ansiterm is a Linux terminal emulator similar to pyte, specifically designed for the Go language. While retaining the powerful features of pyte, it further adapts to the Go ecosystem.

Use Cases

In scenarios involving jump servers and other situations that require strict management of user terminal command execution, it's necessary to filter commands before they are executed by the user. In the development stack based on Golang, we haven't found any related open-source libraries. Additionally, some open-source jump server projects do not support command extraction. Therefore, this tool is mainly developed based on practical needs, to solve the problem of extracting commands executed by terminal users.

Core Features

  • Command Extraction: The core functionality lies in extracting effective information from terminal outputs and echoes, mainly focusing on user command extraction. This feature is extremely useful in jump servers for the convenient extraction and effective filtering of executed commands.

  • Screen Simulation: Includes a screen simulator capable of processing character streams on the screen, supporting operations like cursor movement and text scrolling.

  • ANSI Escape Sequences: Handling various ANSI escape sequences for enhanced terminal interactions.

How to Require

    go get github.com/veops/go-ansiterm

Usage Guide

# First, create a screen object
screen := NewScreen(80, 24)

# Create a stream object
stream := InitByteStream(screen, false)

# Connect the stream object to the screen
stream.Attach(screen

# Feed input into the stream object
stream.Feed(input)

# output
output := screen.Display()

About

Simple VT-compatible linux terminal emulator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages