GitHub 火线榜

GitHub 火线榜 · 仓库档案

jroimartin/gocui

Minimalist Go package aimed at creating Console User Interfaces. (简介来自仓库自身文档。)

数据截至 10月26日jroimartin

最好成绩

#422

总榜 · Go 分面

1.1万

累计 Star

642

Fork 总数

0

近 30 天在榜天数

项目状态许可证: BSD-3-Clause最近 push: 5月1日Open Issues(含 PR): 61

自 2026-10-25 起采集;未知 = 尚未采集到

把上榜徽章放进你的 README · jroimartin/gocui[![把上榜徽章放进你的 README](https://git.vaiox.xyz/api/badge/jroimartin/gocui.svg)](https://git.vaiox.xyz/zh/repo/jroimartin/gocui)
<a href="https://git.vaiox.xyz/zh/repo/jroimartin/gocui"><img src="https://git.vaiox.xyz/api/badge/jroimartin/gocui.svg" alt="把上榜徽章放进你的 README" height="20"></a>

项目文档

GOCUI - Go Console User Interface

Go Reference

Minimalist Go package aimed at creating Console User Interfaces.

Features

  • Minimalist API.
  • Views (the "windows" in the GUI) implement the interface io.ReadWriter.
  • Support for overlapping views.
  • The GUI can be modified at runtime (concurrent-safe).
  • Global and view-level keybindings.
  • Mouse support.
  • Colored text.
  • Customizable edition mode.
  • Easy to build reusable widgets, complex layouts...

Installation

Execute:

go get github.com/jroimartin/gocui

Documentation

Execute:

go doc github.com/jroimartin/gocui

Or visit pkg.go.dev to read it online.

Example

package main

import (
	"fmt"
	"log"

	"github.com/jroimartin/gocui"
)

func main() {
	g, err := gocui.NewGui(gocui.OutputNormal)
	if err != nil {
		log.Panicln(err)
	}
	defer g.Close()

	g.SetManagerFunc(layout)

	if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
		log.Panicln(err)
	}

	if err := g.MainLoop(); err != nil && err != gocui.ErrQuit {
		log.Panicln(err)
	}
}

func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		fmt.Fprintln(v, "Hello world!")
	}
	return nil
}

func quit(g *gocui.Gui, v *gocui.View) error {
	return gocui.ErrQuit
}

Screenshots

r2cui

_examples/demo.go

_examples/dynamic.go

当前上榜

  • 422

    总榜 · 史上最强 · Go

    1.1万 星 · 642 fork · 累计 Star

    总榜 · Go →

近 30 天势头

近 30 天没有上榜记录。

同类项目 · 共享主题

← 回到榜单