1# GOCUI - Go Console User Interface 2[![CircleCI](https://circleci.com/gh/awesome-gocui/gocui/tree/master.svg?style=svg)](https://circleci.com/gh/awesome-gocui/gocui/tree/master) 3[![CodeCov](https://codecov.io/gh/awesome-gocui/gocui/branch/master/graph/badge.svg)](https://codecov.io/gh/awesome-gocui/gocui) 4[![Go Report Card](https://goreportcard.com/badge/github.com/awesome-gocui/gocui)](https://goreportcard.com/report/github.com/awesome-gocui/gocui) 5[![GolangCI](https://golangci.com/badges/github.com/awesome-gocui/gocui.svg)](https://golangci.com/badges/github.com/awesome-gocui/gocui.svg) 6[![GoDoc](https://godoc.org/github.com/awesome-gocui/gocui?status.svg)](https://godoc.org/github.com/awesome-gocui/gocui) 7![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/awesome-gocui/gocui.svg) 8 9Minimalist Go package aimed at creating Console User Interfaces. 10A community fork based on the amazing work of [jroimartin](https://github.com/jroimartin/gocui) 11 12## Features 13 14* Minimalist API. 15* Views (the "windows" in the GUI) implement the interface io.ReadWriter. 16* Support for overlapping views. 17* The GUI can be modified at runtime (concurrent-safe). 18* Global and view-level keybindings. 19* Mouse support. 20* Colored text. 21* Customizable editing mode. 22* Easy to build reusable widgets, complex layouts... 23 24## About fork 25 26This fork has many improvements over the original work from [jroimartin](https://github.com/jroimartin/gocui). 27 28* Written ontop of TCell 29* Better wide character support 30* Support for 1 Line height views 31* Better support for running in docker container 32* Customize frame colors 33* Improved code comments and quality 34* Many small improvements 35* Change Visibility of views 36 37For information about this org see: [awesome-gocui/about](https://github.com/awesome-gocui/about). 38 39## Installation 40 41Execute: 42 43``` 44$ go get github.com/awesome-gocui/gocui 45``` 46 47## Documentation 48 49Execute: 50 51``` 52$ go doc github.com/awesome-gocui/gocui 53``` 54 55Or visit [godoc.org](https://godoc.org/github.com/awesome-gocui/gocui) to read it 56online. 57 58## Example 59See the [_example](./_example/) folder for more examples 60 61```go 62package main 63 64import ( 65 "fmt" 66 "log" 67 68 "github.com/awesome-gocui/gocui" 69) 70 71func main() { 72 g, err := gocui.NewGui(gocui.OutputNormal, true) 73 if err != nil { 74 log.Panicln(err) 75 } 76 defer g.Close() 77 78 g.SetManagerFunc(layout) 79 80 if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil { 81 log.Panicln(err) 82 } 83 84 if err := g.MainLoop(); err != nil && !gocui.IsQuit(err) { 85 log.Panicln(err) 86 } 87} 88 89func layout(g *gocui.Gui) error { 90 maxX, maxY := g.Size() 91 if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2, 0); err != nil { 92 if !gocui.IsUnknownView(err) { 93 return err 94 } 95 96 if _, err := g.SetCurrentView("hello"); err != nil { 97 return err 98 } 99 100 fmt.Fprintln(v, "Hello world!") 101 } 102 103 return nil 104} 105 106func quit(g *gocui.Gui, v *gocui.View) error { 107 return gocui.ErrQuit 108} 109``` 110 111## Screenshots 112 113![r2cui](https://cloud.githubusercontent.com/assets/1223476/19418932/63645052-93ce-11e6-867c-da5e97e37237.png) 114 115![_examples/demo.go](https://cloud.githubusercontent.com/assets/1223476/5992750/720b84f0-aa36-11e4-88ec-296fa3247b52.png) 116 117![_examples/dynamic.go](https://cloud.githubusercontent.com/assets/1223476/5992751/76ad5cc2-aa36-11e4-8204-6a90269db827.png) 118 119## Projects using gocui 120 121* [komanda-cli](https://github.com/mephux/komanda-cli): IRC Client For Developers. 122* [vuls](https://github.com/future-architect/vuls): Agentless vulnerability scanner for Linux/FreeBSD. 123* [wuzz](https://github.com/asciimoo/wuzz): Interactive cli tool for HTTP inspection. 124* [httplab](https://github.com/gchaincl/httplab): Interactive web server. 125* [domainr](https://github.com/MichaelThessel/domainr): Tool that checks the availability of domains based on keywords. 126* [gotime](https://github.com/nanohard/gotime): Time tracker for projects and tasks. 127* [claws](https://github.com/thehowl/claws): Interactive command line client for testing websockets. 128* [terminews](http://github.com/antavelos/terminews): Terminal based RSS reader. 129* [diagram](https://github.com/esimov/diagram): Tool to convert ascii arts into hand drawn diagrams. 130* [pody](https://github.com/JulienBreux/pody): CLI app to manage Pods in a Kubernetes cluster. 131* [kubexp](https://github.com/alitari/kubexp): Kubernetes client. 132* [kcli](https://github.com/cswank/kcli): Tool for inspecting kafka topics/partitions/messages. 133* [fac](https://github.com/mkchoi212/fac): git merge conflict resolver 134* [jsonui](https://github.com/gulyasm/jsonui): Interactive JSON explorer for your terminal. 135* [cointop](https://github.com/miguelmota/cointop): Interactive terminal based UI application for tracking cryptocurrencies. 136* [lazygit](https://github.com/jesseduffield/lazygit): simple terminal UI for git commands. 137* [lazydocker](https://github.com/jesseduffield/lazydocker): The lazier way to manage everything docker. 138 139Note: if your project is not listed here, let us know! :) 140