2020-09-23 23:14:14 +00:00
# cview - Terminal-based user interface toolkit
2021-04-03 15:11:20 +00:00
[![GoDoc ](https://code.rocketnine.space/tslocum/godoc-static/raw/branch/master/badge.svg )](https://docs.rocketnine.space/code.rocketnine.space/tslocum/cview)
2020-01-07 00:59:59 +00:00
[![Donate ](https://img.shields.io/liberapay/receives/rocketnine.space.svg?logo=liberapay )](https://liberapay.com/rocketnine.space)
2017-12-15 14:29:21 +00:00
2020-01-05 17:14:15 +00:00
This package is a fork of [tview ](https://github.com/rivo/tview ).
2021-04-03 15:11:20 +00:00
See [FORK.md ](https://code.rocketnine.space/tslocum/cview/src/branch/master/FORK.md ) for more information.
2018-01-06 21:49:12 +00:00
2020-01-05 17:14:15 +00:00
## Demo
2020-02-22 18:14:57 +00:00
`ssh cview.rocketnine.space -p 20000`
2020-01-05 17:14:15 +00:00
2021-04-03 15:11:20 +00:00
[![Recording of presentation demo ](https://code.rocketnine.space/tslocum/cview/raw/branch/master/cview.svg )](https://code.rocketnine.space/tslocum/cview/src/branch/master/demos/presentation)
2020-01-05 17:14:15 +00:00
## Features
2020-01-04 22:58:58 +00:00
2019-12-30 23:12:17 +00:00
Available widgets:
2018-01-06 21:49:12 +00:00
2019-12-30 23:12:17 +00:00
- __Input forms__ (including __input/password fields__ , __drop-down selections__ , __checkboxes__ , and __buttons__ )
2018-01-07 13:11:26 +00:00
- Navigable multi-color __text views__
2020-04-19 03:00:36 +00:00
- Selectable __lists__ with __context menus__
2020-09-24 15:09:55 +00:00
- Modal __dialogs__
2020-01-23 16:03:22 +00:00
- Horizontal and vertical __progress bars__
2020-10-16 04:28:54 +00:00
- __Grid__, __Flexbox__ and __tabbed panel layouts__
2020-09-24 15:09:55 +00:00
- Sophisticated navigable __table views__
- Flexible __tree views__
- Draggable and resizable __windows__
2018-01-06 21:49:12 +00:00
- An __application__ wrapper
2019-12-30 23:12:17 +00:00
Widgets may be customized and extended to suit any application.
2018-01-06 21:49:12 +00:00
2021-04-03 15:11:20 +00:00
[Mouse support ](https://docs.rocketnine.space/code.rocketnine.space/tslocum/cview#hdr-Mouse_Support ) is available.
2020-01-05 17:14:15 +00:00
2021-01-05 22:29:02 +00:00
## Applications
2021-04-03 15:11:20 +00:00
A list of applications powered by cview is available via [pkg.go.dev ](https://pkg.go.dev/code.rocketnine.space/tslocum/cview?tab=importedby ).
2021-01-05 22:29:02 +00:00
2018-01-06 21:49:12 +00:00
## Installation
```bash
2021-04-03 15:11:20 +00:00
go get code.rocketnine.space/tslocum/cview
2018-01-06 21:49:12 +00:00
```
## Hello World
2020-10-13 04:48:00 +00:00
This basic example creates a TextView titled "Hello, World!" and displays it in your terminal:
2018-01-06 21:49:12 +00:00
```go
package main
import (
2021-04-03 15:11:20 +00:00
"code.rocketnine.space/tslocum/cview"
2018-01-06 21:49:12 +00:00
)
func main() {
2020-10-12 17:19:41 +00:00
app := cview.NewApplication()
2021-06-04 03:40:23 +00:00
tv := cview.NewTextView()
tv.SetBorder(true)
tv.SetTitle("Hello, world!")
tv.SetText("Lorem ipsum dolor sit amet")
2020-10-12 17:19:41 +00:00
2021-06-04 03:40:23 +00:00
app.SetRoot(tv, true)
2020-10-12 17:19:41 +00:00
if err := app.Run(); err != nil {
2018-01-06 21:49:12 +00:00
panic(err)
}
}
```
2021-04-03 15:11:20 +00:00
Examples are available via [godoc ](https://docs.rocketnine.space/code.rocketnine.space/tslocum/cview#pkg-examples )
2021-06-05 17:24:43 +00:00
and in the [demos ](https://code.rocketnine.space/tslocum/cview/src/branch/master/demos ) directory.
2018-01-06 21:49:12 +00:00
2019-12-30 23:12:17 +00:00
For a presentation highlighting the features of this package, compile and run
2021-06-05 17:24:43 +00:00
the program in the [demos/presentation ](https://code.rocketnine.space/tslocum/cview/src/branch/master/demos/presentation ) directory.
2018-01-06 21:49:12 +00:00
## Documentation
2021-04-03 15:11:20 +00:00
Package documentation is available via [godoc ](https://docs.rocketnine.space/code.rocketnine.space/tslocum/cview ).
2020-01-22 23:28:19 +00:00
2020-01-23 16:03:22 +00:00
An [introduction tutorial ](https://rocketnine.space/post/tview-and-you/ ) is also available.
2018-01-06 21:49:12 +00:00
## Dependencies
2019-12-30 23:12:17 +00:00
This package is based on [github.com/gdamore/tcell ](https://github.com/gdamore/tcell )
(and its dependencies) and [github.com/rivo/uniseg ](https://github.com/rivo/uniseg ).
## Support
2021-04-03 15:11:20 +00:00
[CONTRIBUTING.md ](https://code.rocketnine.space/tslocum/cview/src/branch/master/CONTRIBUTING.md ) describes how to share
2019-12-30 23:12:17 +00:00
issues, suggestions and patches (pull requests).