wick3dr0se / term

A small library of helpful terminal procedures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Term 📚

This library provides functionality for interacting with the terminal, manipulating terminal modes, screen buffers, cursor behavior, generating colors and more. term among many things, can assist in building a TUI without a dependency to curses, abstract the difficulty of working with the terminal and ANSI escape sequences

The convienently (clearly not creatively) named term library mainly utilizies the termios library, raw ANSI escape sequences and other standard Nim libraries


Installation

Install term from nimble

nimble install https://github.com/wick3dr0se/term

Usage

Import term

import term

A basic few implementations

Set the terminal to raw, canonical, noecho or cooked (default) mode

setMode(noecho) # disable echoing to the terminal

setMode(cooked) # *reset* the terminal

Scroll the terminal screen

scrollUp(10) # scroll up 10 lines

scrollDown() # scroll down 1 (implicit) line

Switch to the alternative screen buffer

altBuffer()

mainBuffer() # switch back to the main buffer

Output a random colored string

echoRandColor("test") # will print in true color if possible

About

A small library of helpful terminal procedures

License:GNU General Public License v3.0


Languages

Language:Nim 100.0%