README.md

  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* Better wide character support
 29* Support for 1 Line height views
 30* Better support for running in docker container
 31* Customize frame colors
 32* Improved code comments and quality
 33* Many small improvements
 34* Change Visibility of views
 35
 36For information about this org see: [awesome-gocui/about](https://github.com/awesome-gocui/about).
 37
 38## Installation
 39
 40Execute:
 41
 42```
 43$ go get github.com/awesome-gocui/gocui
 44```
 45
 46## Documentation
 47
 48Execute:
 49
 50```
 51$ go doc github.com/awesome-gocui/gocui
 52```
 53
 54Or visit [godoc.org](https://godoc.org/github.com/awesome-gocui/gocui) to read it
 55online.
 56
 57## Example
 58See the [_example](./_example/) folder for more examples
 59
 60```go
 61package main
 62
 63import (
 64	"fmt"
 65	"log"
 66
 67	"github.com/awesome-gocui/gocui"
 68)
 69
 70func main() {
 71	g, err := gocui.NewGui(gocui.OutputNormal, false)
 72	if err != nil {
 73		log.Panicln(err)
 74	}
 75	defer g.Close()
 76
 77	g.SetManagerFunc(layout)
 78
 79	if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
 80		log.Panicln(err)
 81	}
 82
 83	if err := g.MainLoop(); err != nil && !gocui.IsQuit(err) {
 84		log.Panicln(err)
 85	}
 86}
 87
 88func layout(g *gocui.Gui) error {
 89	maxX, maxY := g.Size()
 90	if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2, 0); err != nil {
 91		if !gocui.IsUnknownView(err) {
 92			return err
 93		}
 94		fmt.Fprintln(v, "Hello world!")
 95		if _, err := g.SetCurrentView("hello"); err != nil {
 96			return err
 97		}
 98	}
 99	return nil
100}
101
102func quit(g *gocui.Gui, v *gocui.View) error {
103	return gocui.ErrQuit
104}
105```
106
107## Screenshots
108
109![r2cui](https://cloud.githubusercontent.com/assets/1223476/19418932/63645052-93ce-11e6-867c-da5e97e37237.png)
110
111![_examples/demo.go](https://cloud.githubusercontent.com/assets/1223476/5992750/720b84f0-aa36-11e4-88ec-296fa3247b52.png)
112
113![_examples/dynamic.go](https://cloud.githubusercontent.com/assets/1223476/5992751/76ad5cc2-aa36-11e4-8204-6a90269db827.png)
114
115## Projects using gocui
116
117* [komanda-cli](https://github.com/mephux/komanda-cli): IRC Client For Developers.
118* [vuls](https://github.com/future-architect/vuls): Agentless vulnerability scanner for Linux/FreeBSD.
119* [wuzz](https://github.com/asciimoo/wuzz): Interactive cli tool for HTTP inspection.
120* [httplab](https://github.com/gchaincl/httplab): Interactive web server.
121* [domainr](https://github.com/MichaelThessel/domainr): Tool that checks the availability of domains based on keywords.
122* [gotime](https://github.com/nanohard/gotime): Time tracker for projects and tasks.
123* [claws](https://github.com/thehowl/claws): Interactive command line client for testing websockets.
124* [terminews](http://github.com/antavelos/terminews): Terminal based RSS reader.
125* [diagram](https://github.com/esimov/diagram): Tool to convert ascii arts into hand drawn diagrams.
126* [pody](https://github.com/JulienBreux/pody): CLI app to manage Pods in a Kubernetes cluster.
127* [kubexp](https://github.com/alitari/kubexp): Kubernetes client.
128* [kcli](https://github.com/cswank/kcli): Tool for inspecting kafka topics/partitions/messages.
129* [fac](https://github.com/mkchoi212/fac): git merge conflict resolver
130* [jsonui](https://github.com/gulyasm/jsonui): Interactive JSON explorer for your terminal.
131* [cointop](https://github.com/miguelmota/cointop): Interactive terminal based UI application for tracking cryptocurrencies.
132* [lazygit](https://github.com/jesseduffield/lazygit): simple terminal UI for git commands.
133* [lazydocker](https://github.com/jesseduffield/lazydocker): The lazier way to manage everything docker.
134
135Note: if your project is not listed here, let us know! :)