Skip to content

SAANN3/bash-tui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bash-tui

A library for building simple terminal user interfaces, written (almost) fully within bash. Can be used for creating various interactive bash scripts, while events like ctrl+c press or resize events are handled during render.

img

Above is result of test.sh in examples folder

Features

This library provides necessary features for building tui like

  • Layout system
  • Styling components
  • Ready to use components:
    • Rect
    • Label
    • List
    • Gauge
    • Modal

Requirements

  • Bash 4+
  • Unix-like terminal

Installation

Clone the repository and place it anywhere you want.

git clone https://github.com/SAANN3/bash-tui

Then at beginning of your script source src/lib.sh file

#!/bin/bash
source src/lib.sh
## rest of code...

Quickstart

Here is a simple hello world example, that increments a value by 1 every frame

source ../src/lib.sh

init_screen

layout.create_from_screen Layout

rect.new rect1
rect.get_layout rect1 layout_inside_rect
label.new label1 "Hello world!"
label.set_text_align label1 center center

i=0
while [ 1 ]; do
    rect.draw rect1 Layout
    i=$((i + 1))
    label.set_text label1 "Hello world!: $i"
    label.draw label1 layout_inside_rect
    buffer.flush
    sleep 1
done
exit_screen

Examples

Examples folder contains examples of usages of this library. these examples were written while creating documentation below, so you can read it first if you want.

Examples

Docs

For learning API and getting better understanding of its usage, you can see pages below

  1. Getting started
  2. Layouts
  3. Styling
  4. Components
  5. Writing component

About

simple library for creating tui interfaces, written in bash

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages