A powerful little TUI framework 🏗
Go to file
Christian Rocha 989d49f3e6 feat: add Sequence for running commands in order. Closes #413.
This deprecates Sequentially.
2022-08-30 13:07:05 -07:00
.github fix: add tutorials dir to dependabot config 2022-06-08 14:37:53 +02:00
examples feat: add Sequence for running commands in order. Closes #413. 2022-08-30 13:07:05 -07:00
tutorials fix: support multi-byte strings on Windows (#343) 2022-08-19 09:25:22 -07:00
.gitignore docs: README progress-download folder + ignore 2022-08-18 12:57:30 -04: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
CONTRIBUTING.md docs: Add CONTRIBUTING.md (#405) 2022-08-18 15:22:59 -04:00
LICENSE Add MIT license 2020-01-24 15:07:54 -05:00
README.md docs: fix mobile resize issue on example using `picture` tag 2022-08-30 12:44:58 -04:00
commands.go feat: add Sequence for running commands in order. Closes #413. 2022-08-30 13:07:05 -07: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 docs: fix typo 2022-08-27 10:22:11 +02:00
go.mod fix: support multi-byte strings on Windows (#343) 2022-08-19 09:25:22 -07:00
go.sum fix: support multi-byte strings on Windows (#343) 2022-08-19 09:25:22 -07:00
key.go keys: properly support the alt modifier 2022-08-30 11:17:11 +02:00
key_test.go keys: properly support the alt modifier 2022-08-30 11:17:11 +02:00
logging.go chore: gofmt sources 2022-08-15 12:25:55 +02:00
logging_test.go test: logging test 2021-10-12 14:21:02 -04:00
mouse.go chore: gofmt sources 2022-08-15 12:25:55 +02: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 chore: gofmt sources 2022-08-15 12:25:55 +02: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 enable compilation on AIX 2022-07-29 15:58:06 +02: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 feat: add Sequence for running commands in order. Closes #413. 2022-08-30 13:07:05 -07: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 enable compilation on AIX 2022-07-29 15:58:06 +02: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.log 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
  • Aztify: bring Microsoft Azure resources under Terraform
  • Canard: an RSS client
  • charm: the official Charm user account manager
  • circumflex: read Hacker News in your terminal
  • clidle: a Wordle clone for your terminal
  • container-canary: a container validator
  • dns53: dynamic DNS with Amazon Route53. Expose your EC2 quickly, securely and privately
  • fm: a terminal-based file manager
  • flapioca: Flappy Bird on the CLI!
  • fztea: connect to your Flipper's UI over serial or make it accessible via SSH
  • 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
  • mandelbrot-cli: Multiplatform terminal mandelbrot set explorer
  • mergestat: run SQL queries on git repositories
  • mc: the official MinIO client
  • pathos: pathos - CLI for editing a PATH env variable
  • portal: securely send transfer between computers
  • redis-viewer: browse Redis databases
  • sku: a simple TUI for playing sudoku inside the terminal
  • 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
  • ugm: a unix user and group browser
  • Typer: a typing test
  • wishlist: an SSH directory
  • Noted: Note viewer and manager

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