An open API service indexing awesome lists of open source software.

https://github.com/wick3dr0se/term

A small library of helpful terminal procedures
https://github.com/wick3dr0se/term

library module nim nim-lang nimble

Last synced: 4 days ago
JSON representation

A small library of helpful terminal procedures

Awesome Lists containing this project

README

          


Term :books:


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`
```bash
nimble install https://github.com/wick3dr0se/term
```

# Usage
Import `term`
```python
import term
```

## A basic few implementations

Set the terminal to raw, canonical, noecho or cooked (default) mode
```python
setMode(noecho) # disable echoing to the terminal

setMode(cooked) # *reset* the terminal
```

Scroll the terminal screen
```python
scrollUp(10) # scroll up 10 lines

scrollDown() # scroll down 1 (implicit) line
```

Switch to the alternative screen buffer
```python
altBuffer()

mainBuffer() # switch back to the main buffer
```

Output a random colored string
```python
echoRandColor("test") # will print in true color if possible
```