From a01016fd0db1e749d0dffea94598b51d68f0cf73 Mon Sep 17 00:00:00 2001 From: Caleb Bassi Date: Mon, 28 Jan 2019 01:13:33 -0800 Subject: [PATCH] Update readme --- README.md | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9a29f81..296607f 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,46 @@ termui is a cross-platform and fully-customizable terminal dashboard and widget library built on top of [termbox-go](https://github.com/nsf/termbox-go). It is inspired by [blessed-contrib](https://github.com/yaronn/blessed-contrib) and [tui-rs](https://github.com/fdehau/tui-rs) and written purely in Go. -The core components of termui include: +## Features -- built in widget implementations for common use cases -- utilities to create custom widgets -- a Grid for relative widget positioning -- an event system for keyboard, mouse and resizing events -- colors and styling +- Built in widget implementations for common use cases +- Utilities to create custom widgets +- A grid layout for relative widget positioning +- Mouse support +- Event handling for keyboard, mouse and resizing events +- Colors and styling + +## Hello World + +```go +package main + +import ( + "log" + + ui "github.com/gizak/termui" + "github.com/gizak/termui/widgets" +) + +func main() { + if err := ui.Init(); err != nil { + log.Fatalf("failed to initialize termui: %v", err) + } + defer ui.Close() + + p := widgets.NewParagraph() + p.Text = "Hello World!" + p.SetRect(0, 0, 25, 5) + + ui.Render(p) + + for e := range ui.PollEvents() { + if e.Type == ui.KeyboardEvent { + break + } + } +} +``` ## Installation