osui

package module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

A Component-based TUI library written in Go

Hello World

package main

import (
	"github.com/orus-dev/osui"
	"github.com/orus-dev/osui/ui"
)

func main() {
    app := ui.Div(
        ui.Text("Hello, World!")
    )

    screen := osui.NewScreen(app)
    screen.Run()
}

Documentation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

func CompressString

func CompressString(input string) (string, map[int]string)

func DisableEcho added in v0.1.5

func DisableEcho()

func EnableEcho added in v0.1.5

func EnableEcho()

func GetTerminalSize added in v0.1.0

func GetTerminalSize() (int, int)

Get the terminal size

func HideCursor added in v0.1.0

func HideCursor()

func LogicValue added in v0.1.0

func LogicValue(b bool, _if, _else string) string

func LogicValueInt added in v0.1.0

func LogicValueInt(b bool, _if, _else int) int

func NewFrame

func NewFrame(width, height int) []string

func ReadKey

func ReadKey() (string, error)

func RenderLine added in v0.1.4

func RenderLine(frame_, line_ string, x int, fm, lm map[int]string) string

func RenderOnFrame

func RenderOnFrame(c Component, frame *[]string)

func SetDefaults

func SetDefaults(p interface{}) interface{}

func ShowCursor added in v0.1.0

func ShowCursor()

func UseStyle added in v0.1.0

func UseStyle(p interface{})

Types

type Component

type Component interface {
	Render() string
	GetComponentData() *ComponentData
	Update(string) bool
}

type ComponentData

type ComponentData struct {
	X            int
	Y            int
	Width        int
	Height       int
	DefaultColor string
	IsActive     bool
	Screen       *Screen
}

type Screen

type Screen struct {
	// contains filtered or unexported fields
}

func NewScreen

func NewScreen(c Component) *Screen

func (*Screen) Render

func (s *Screen) Render()

func (*Screen) Run added in v0.1.0

func (s *Screen) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳