在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:jroimartin/gocui开源软件地址:https://github.com/jroimartin/gocui开源编程语言:Go 100.0%开源软件介绍:GOCUI - Go Console User InterfaceMinimalist Go package aimed at creating Console User Interfaces. Features
InstallationExecute:
DocumentationExecute:
Or visit pkg.go.dev to read it online. Examplepackage 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
} ScreenshotsProjects using gocui
Note: if your project is not listed here, let us know! :) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论