A powerful little TUI framework 🏗
Go to file
bashbunni 2b9d4e3015 chore: fix Println typo 2022-07-20 01:46:48 +02:00
.github fix: add tutorials dir to dependabot config 2022-06-08 14:37:53 +02:00
examples chore: Bump bubbles to v0.13.0 (#363) 2022-07-08 10:08:24 -04:00
tutorials docs: link to tutorial + general README edits (#344) 2022-07-19 16:23:37 -07:00
.gitignore docs: link to tutorial + general README edits (#344) 2022-07-19 16:23:37 -07:00
.golangci-soft.yml Add separate sets of hard- and soft-enforced linters 2022-01-07 13:25:29 -05:00
.golangci.yml Add separate sets of hard- and soft-enforced linters 2022-01-07 13:25:29 -05:00
LICENSE Add MIT license 2020-01-24 15:07:54 -05:00
README.md docs: link to tutorial + general README edits (#344) 2022-07-19 16:23:37 -07:00
commands.go docs: improve godoc on tick and every (#320) 2022-05-29 21:40:57 -03:00
commands_test.go feat: tea.Batch returns nil if all cmds are nil (#217) 2022-02-03 12:08:34 -03:00
exec.go chore(exec): small API edits (#323) 2022-06-01 17:12:21 -07:00
go.mod feat: update cancelreader (#353) 2022-06-23 09:19:36 -03:00
go.sum feat: update cancelreader (#353) 2022-06-23 09:19:36 -03:00
key.go fix: handle batched key msgs 2022-06-08 14:03:28 +02:00
key_test.go fix: handle batched key msgs 2022-06-08 14:03:28 +02:00
logging.go Correct logic where we add a space after the prefix when logging 2021-03-01 18:05:53 -05:00
logging_test.go test: logging test 2021-10-12 14:21:02 -04:00
mouse.go Support receiving batched mouse events 2022-02-13 08:40:04 +01:00
mouse_test.go Support receiving batched mouse events 2022-02-13 08:40:04 +01:00
nil_renderer.go Fix a race where artifacts could print when exiting a program 2021-06-02 14:49:54 -04:00
nil_renderer_test.go test: nil renderer, options and screen 2021-11-15 10:28:46 -05:00
options.go ANSI compression is now opt-in via the WithANSICompressor program option 2021-10-30 13:04:27 -04:00
options_test.go test: fix error in custom input test 2022-06-04 15:21:08 +02:00
renderer.go add: Exec, ReleaseTerminal and RestoreTerminal to re-use input and terminal (#237) 2022-04-12 10:23:10 -04:00
screen.go add: Exec, ReleaseTerminal and RestoreTerminal to re-use input and terminal (#237) 2022-04-12 10:23:10 -04:00
screen_test.go test: nil renderer, options and screen 2021-11-15 10:28:46 -05:00
signals_unix.go Cancelable reads (#120) 2021-09-28 13:30:11 -04:00
signals_windows.go Add missing Go 1.17 build tags in Windows files 2021-10-02 21:13:03 -04:00
standard_renderer.go chore: fix Println typo 2022-07-20 01:46:48 +02:00
tea.go doc: Fix `Printf` typo (#358) 2022-06-28 15:34:22 -04:00
tty.go add: Exec, ReleaseTerminal and RestoreTerminal to re-use input and terminal (#237) 2022-04-12 10:23:10 -04:00
tty_unix.go Annotate why we ignore error 2022-01-07 13:25:29 -05:00
tty_windows.go Add missing Go 1.17 build tags in Windows files 2021-10-02 21:13:03 -04:00

README.md

Bubble Tea

Bubble Tea Title Treatment
Latest Release GoDoc Build Status

The fun, functional and stateful way to build terminal apps. A Go framework based on The Elm Architecture. Bubble Tea is well-suited for simple and complex terminal applications, either inline, full-window, or a mix of both.

Bubble Tea Example

Bubble Tea is in use in production and includes a number of features and performance optimizations weve added along the way. Among those is a standard framerate-based renderer, a renderer for high-performance scrollable regions which works alongside the main renderer, and mouse support.

Getting Started

We recommend starting with the basics tutorial followed by the commands tutorial, both of which should give you a good understanding of how things work.

There are a bunch of examples, too!

Components

For a bunch of basic user interface components check out Bubbles, the official Bubble Tea component library.

Bubbles Badge   Text Input Example from Bubbles

Debugging

Debugging with Delve

Since Bubble Tea apps assume control of stdin and stdout, youll need to run delve in headless mode and then connect to it:

# Start the debugger
$ dlv debug --headless .
API server listening at: 127.0.0.1:34241

# Connect to it from another terminal
$ dlv connect 127.0.0.1:34241

Note that the default port used will vary on your system and per run, so actually watch out what address the first dlv run tells you to connect to.

Logging Stuff

You can log to a debug file to print debug Bubble Tea applications. To do so, include something like…

if len(os.Getenv("DEBUG")) > 0 {
	f, err := tea.LogToFile("debug.log", "debug")
	if err != nil {
		fmt.Println("fatal:", err)
		os.Exit(1)
	}
	defer f.Close()
}

…before you start your Bubble Tea program. To see whats printed in real time, run tail -f debug.go while you run your program in another window.

Libraries we use with Bubble Tea

  • Bubbles: Common Bubble Tea components such as text inputs, viewports, spinners and so on
  • Lip Gloss: Style, format and layout tools for terminal applications
  • Harmonica: A spring animation library for smooth, natural motion
  • BubbleZone: Easy mouse event tracking for Bubble Tea components
  • Termenv: Advanced ANSI styling for terminal applications
  • Reflow: Advanced ANSI-aware methods for working with text

Bubble Tea in the Wild

For some Bubble Tea programs in production, see:

  • AT CLI: a utility for executing AT Commands via serial port connections
  • Canard: an RSS client
  • The Charm Tool: the Charm user account manager
  • clidle: a Wordle clone for your terminal
  • fm: a terminal-based file manager
  • fork-cleaner: cleans up old and inactive forks in your GitHub account
  • gambit: play chess in the terminal
  • gembro: a mouse-driven Gemini browser
  • gh-b: GitHub CLI extension to easily manage your branches
  • gh-dash: GitHub CLI extension to display a dashboard of PRs and issues
  • gitflow-toolkit: a GitFlow submission tool
  • Glow: a markdown reader, browser and online markdown stash
  • gocovsh: explore Go coverage reports from the CLI
  • httpit: a rapid http(s) benchmark tool
  • IDNT: batch software uninstaller
  • kboard: a typing game
  • mergestat: run SQL queries on git repositories
  • mc: the official MinIO client
  • portal: securely send transfer between computers
  • redis-viewer: browse Redis databases
  • Slides: a markdown-based presentation tool
  • Soft Serve: a command-line-first Git server that runs a TUI over SSH
  • StormForge Optimize Controller: a tool for experimenting with application configurations in Kubernetes
  • STTG: teletext client for SVT, Swedens national public television station
  • sttr: run various text transformations
  • tasktimer: a dead-simple task timer
  • termdbms: a keyboard and mouse driven database browser
  • ticker: a terminal stock watcher and stock position tracker
  • tran: securely transfer stuff between computers (based on portal)
  • tz: an aid for scheduling across multiple time zones
  • Typer: a typing test
  • wishlist: an SSH directory

Feedback

We'd love to hear your thoughts on this tutorial. Feel free to drop us a note!

Acknowledgments

Bubble Tea is based on the paradigms of The Elm Architecture by Evan Czaplicki et alia and the excellent go-tea by TJ Holowaychuk. Its inspired by the many great Zeichenorientierte Benutzerschnittstellen of days past.

License

MIT


Part of Charm.

The Charm logo

Charm热爱开源 • Charm loves open source