tview README

The project's README from github.com/rivo/tview. As one markdown file: README.md.

Rich Interactive Widgets for Terminal UIs

PkgGoDev Go Report

This Go package provides commonly used components for terminal based user interfaces.

Screenshot

Among these components are:

They come with lots of customization options and can be easily extended to fit your needs.

Usage

To add this package to your project:

go get github.com/rivo/tview@master

Hello World

This basic example creates a box titled "Hello, World!" and displays it in your terminal:

package main

import (
	"github.com/rivo/tview"
)

func main() {
	box := tview.NewBox().SetBorder(true).SetTitle("Hello, world!")
	if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil {
		panic(err)
	}
}

Check out the GitHub Wiki for more examples along with screenshots. Or try the examples in the "demos" subdirectory.

For a presentation highlighting this package, compile and run the program found in the "demos/presentation" subdirectory.

Projects using tview

Documentation

Refer to https://pkg.go.dev/github.com/rivo/tview for the package's documentation. Also check out the Wiki.

Dependencies

This package is based on github.com/gdamore/tcell (and its dependencies) as well as on github.com/rivo/uniseg.

Sponsor this Project

Become a Sponsor on GitHub to further this project!

Backwards-Compatibility

I try really hard to keep this project backwards compatible. Your software should not break when you upgrade tview. But this also means that some of its shortcomings that were present in the initial versions will remain. Having said that, backwards compatibility may still break when:

Your Feedback

Add your issue here on GitHub. Feel free to get in touch if you have any questions.

Code of Conduct

We follow Golang's Code of Conduct which you can find here.

tview (rivo/tview)

Searching Database…

14.1K ·GitHub
这是什么?tview 是一个 Go 包,提供现成的交互式控件,用于构建终端用户界面,包括输入表单、文本视图、文本编辑区、表格、树形视图、列表、图片、布局和模态窗口。
它是框架还是库?它是一个 Go 库,你可以把它导入自己的程序中,其中也包含一个负责运行事件循环的应用包装器;它本身不是独立的应用程序。
我该怎么把它加到项目里?使用 Go 标准的模块工具(go get)把这个包添加到你的 Go 项目中,然后导入它,并以其中的 'Hello, World!' 方框示例作为起点。
tview 依赖什么?它基于 github.com/gdamore/tcell 处理终端,并使用 github.com/rivo/uniseg 进行 Unicode 文本分割。
以后升级时我的代码会出问题吗?作者会尽力保持 tview 向后兼容,但如果 tcell 的变化迫使它调整、某个缺陷被修复,或 Primitive 等内部接口发生变化,仍可能出现不兼容的情况。
tview 开箱即用地包含哪些控件?带文本框、选择项、复选框和按钮的输入表单,多色文本视图,可编辑的文本编辑区,可导航的表格,树形视图,可选择的列表,图片,Flexbox、网格和页面布局,以及模态消息窗口。
在哪里可以看到 tview 的实际应用示例?README 列出了数十个用 tview 构建的真实项目,例如 K9s(Kubernetes 命令行工具)、gh(GitHub 命令行工具)、lazysql 和 podman-tui,此外还有一个 'demos' 子目录和带截图的 GitHub Wiki。
为什么 tview 在命令行工具开发者中很受欢迎?它为 Go 开发者提供了现成且可定制的终端控件,无需从零开始构建表单、表格和布局,这也是许多热门 Go 命令行工具(K9s、gh、ktop)采用它的原因。
Creator
rivo
Size
6.4 MB
Stars
14.1K
Age
8y
Commits · 90 Days