Skip to content
/ tuikit Public

Opinionated set of Go TUI development types and tools

License

Notifications You must be signed in to change notification settings

jahvon/tuikit

Repository files navigation

Terminal UI Kit

Go Report Card Go Reference GitHub release

This repo contains types, interfaces, and utilities for building terminal user interfaces in Go. It's an opinionated framework that uses charm TUI components and packages for rendering and handling terminal events.

Usage

First, install the package:

go get -u github.com/jahvon/tuikit@latest

You can then use the package in your Go code:

package main

import (
    "context"

    "github.com/jahvon/tuikit"
    "github.com/jahvon/tuikit/views"
)

func main() {
    ctx := context.Background()
    // Define your application metadata
    app := &tuikit.Application{Name: "MyApp"}

    // Create and start the container
    container, err := tuikit.NewContainer(ctx, app)
    if err != nil {
        panic(err)
    }
    if err := container.Start(); err != nil {
        panic(err)
    }
    
    // Create and set your view - the example below used the Markdown view type.
    // There are other view types available in the views package.
    view := views.NewMarkdownView(container.RenderState(), "# Hello, world!")
    if err := container.SetView(view); err != nil {
        panic(err)
    }
    
    // Wait for the container to exit. Before getting here, you can handle events, update the view, etc.
    container.WaitForExit()
}

Also see the sample app for examples of how different views can be used.

About

Opinionated set of Go TUI development types and tools

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages