MCPcopy
hub / github.com/gizak/termui

github.com/gizak/termui @v3.1.0 sqlite

repository ↗ · DeepWiki ↗ · release v3.1.0 ↗
215 symbols 506 edges 47 files 48 documented · 22%
README

termui

demo cast under osx 10.10; Terminal.app; Menlo Regular 12pt.)

termui is a cross-platform and fully-customizable terminal dashboard and widget library built on top of termbox-go. It is inspired by blessed-contrib and tui-rs and written purely in Go.

Features

  • Several premade widgets for common use cases
  • Easily create custom widgets
  • Position widgets either in a relative grid or with absolute coordinates
  • Keyboard, mouse, and terminal resizing events
  • Colors and styling

Installation

Go modules

It is not necessary to go get termui, since Go will automatically manage any imported dependencies for you. Do note that you have to include /v3 in the import statements as shown in the 'Hello World' example below.

Dep

Add with dep ensure -add github.com/gizak/termui. With Dep, /v3 should not be included in the import statements.

Hello World

package main

import (
    "log"

    ui "github.com/gizak/termui/v3"
    "github.com/gizak/termui/v3/widgets"
)

func main() {
    if err := ui.Init(); err != nil {
        log.Fatalf("failed to initialize termui: %v", err)
    }
    defer ui.Close()

    p := widgets.NewParagraph()
    p.Text = "Hello World!"
    p.SetRect(0, 0, 25, 5)

    ui.Render(p)

    for e := range ui.PollEvents() {
        if e.Type == ui.KeyboardEvent {
            break
        }
    }
}

Widgets

Run an example with go run _examples/{example}.go or run each example consecutively with make run-examples.

Documentation

Uses

Related Works

License

MIT

Extension points exported contracts — how you extend this code

PieChartLabel (FuncType)
PieChartLabel callback
v3/widgets/piechart.go
Drawable (Interface)
(no doc) [1 implementers]
v3/render.go
TreeWalkFn (FuncType)
TreeWalkFn is a function used for walking a Tree. To interrupt the walking process function should return false.
v3/widgets/tree.go

Core symbols most depended-on inside this repo

SetRect
called by 44
v3/render.go
NewStyle
called by 42
v3/style.go
SetCell
called by 38
v3/buffer.go
NewCell
called by 27
v3/buffer.go
Draw
called by 14
v3/render.go
NewBlock
called by 14
v3/block.go
SetString
called by 11
v3/buffer.go
SelectColor
called by 10
v3/utils.go

Shape

Method 79
Function 78
Struct 44
TypeAlias 11
FuncType 2
Interface 1

Languages

Go99%
Python1%

Modules by API surface

v3/widgets/tree.go26 symbols
v3/utils.go23 symbols
v3/widgets/image.go13 symbols
v3/theme.go13 symbols
v3/widgets/list.go12 symbols
v3/widgets/piechart.go10 symbols
v3/widgets/plot.go9 symbols
v3/grid.go9 symbols
v3/drawille/drawille.go9 symbols
v3/events.go8 symbols
v3/buffer.go8 symbols
v3/block.go6 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

github.com/mattn/go-runewidthv0.0.2 · 1×
github.com/mitchellh/go-wordwrapv0.0.0-2015031417033 · 1×
github.com/nsf/termbox-gov0.0.0-2019012123311 · 1×

For agents

$ claude mcp add termui \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact