• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

_examples/H03-May-2022-

.gitignoreH A D11-Apr-20186

AUTHORSH A D11-Apr-2018730

LICENSEH A D11-Apr-20181.5 KiB

README.mdH A D11-Apr-20183.3 KiB

attribute.goH A D11-Apr-20181.2 KiB

doc.goH A D11-Apr-20183.2 KiB

edit.goH A D11-Apr-20187.5 KiB

escape.goH A D11-Apr-20185 KiB

gui.goH A D11-Apr-201815.9 KiB

keybinding.goH A D11-Apr-20184.8 KiB

view.goH A D11-Apr-201811.4 KiB

README.md

1# GOCUI - Go Console User Interface
2
3[![GoDoc](https://godoc.org/github.com/jroimartin/gocui?status.svg)](https://godoc.org/github.com/jroimartin/gocui)
4
5Minimalist Go package aimed at creating Console User Interfaces.
6
7## Features
8
9* Minimalist API.
10* Views (the "windows" in the GUI) implement the interface io.ReadWriter.
11* Support for overlapping views.
12* The GUI can be modified at runtime (concurrent-safe).
13* Global and view-level keybindings.
14* Mouse support.
15* Colored text.
16* Customizable edition mode.
17* Easy to build reusable widgets, complex layouts...
18
19## Installation
20
21Execute:
22
23```
24$ go get github.com/jroimartin/gocui
25```
26
27## Documentation
28
29Execute:
30
31```
32$ go doc github.com/jroimartin/gocui
33```
34
35Or visit [godoc.org](https://godoc.org/github.com/jroimartin/gocui) to read it
36online.
37
38## Example
39
40```go
41package main
42
43import (
44	"fmt"
45	"log"
46
47	"github.com/jroimartin/gocui"
48)
49
50func main() {
51	g, err := gocui.NewGui(gocui.OutputNormal)
52	if err != nil {
53		log.Panicln(err)
54	}
55	defer g.Close()
56
57	g.SetManagerFunc(layout)
58
59	if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
60		log.Panicln(err)
61	}
62
63	if err := g.MainLoop(); err != nil && err != gocui.ErrQuit {
64		log.Panicln(err)
65	}
66}
67
68func layout(g *gocui.Gui) error {
69	maxX, maxY := g.Size()
70	if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2); err != nil {
71		if err != gocui.ErrUnknownView {
72			return err
73		}
74		fmt.Fprintln(v, "Hello world!")
75	}
76	return nil
77}
78
79func quit(g *gocui.Gui, v *gocui.View) error {
80	return gocui.ErrQuit
81}
82```
83
84## Screenshots
85
86![r2cui](https://cloud.githubusercontent.com/assets/1223476/19418932/63645052-93ce-11e6-867c-da5e97e37237.png)
87
88![_examples/demo.go](https://cloud.githubusercontent.com/assets/1223476/5992750/720b84f0-aa36-11e4-88ec-296fa3247b52.png)
89
90![_examples/dynamic.go](https://cloud.githubusercontent.com/assets/1223476/5992751/76ad5cc2-aa36-11e4-8204-6a90269db827.png)
91
92## Projects using gocui
93
94* [komanda-cli](https://github.com/mephux/komanda-cli): IRC Client For Developers.
95* [vuls](https://github.com/future-architect/vuls): Agentless vulnerability scanner for Linux/FreeBSD.
96* [wuzz](https://github.com/asciimoo/wuzz): Interactive cli tool for HTTP inspection.
97* [httplab](https://github.com/gchaincl/httplab): Interactive web server.
98* [domainr](https://github.com/MichaelThessel/domainr): Tool that checks the availability of domains based on keywords.
99* [gotime](https://github.com/nanohard/gotime): Time tracker for projects and tasks.
100* [claws](https://github.com/thehowl/claws): Interactive command line client for testing websockets.
101* [terminews](http://github.com/antavelos/terminews): Terminal based RSS reader.
102* [diagram](https://github.com/esimov/diagram): Tool to convert ascii arts into hand drawn diagrams.
103* [pody](https://github.com/JulienBreux/pody): CLI app to manage Pods in a Kubernetes cluster.
104* [kubexp](https://github.com/alitari/kubexp): Kubernetes client.
105* [kcli](https://github.com/cswank/kcli): Tool for inspecting kafka topics/partitions/messages.
106* [fac](https://github.com/mkchoi212/fac): git merge conflict resolver
107* [jsonui](https://github.com/gulyasm/jsonui): Interactive JSON explorer for your terminal.
108* [cointop](https://github.com/miguelmota/cointop): Interactive terminal based UI application for tracking cryptocurrencies.
109
110Note: if your project is not listed here, let us know! :)
111