https://github.com/aserto-dev/clui
Command Line User Interface
https://github.com/aserto-dev/clui
Last synced: 8 months ago
JSON representation
Command Line User Interface
- Host: GitHub
- URL: https://github.com/aserto-dev/clui
- Owner: aserto-dev
- License: mit
- Created: 2021-02-14T21:17:59.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-11-27T18:23:45.000Z (over 2 years ago)
- Last Synced: 2025-03-12T05:03:08.419Z (over 1 year ago)
- Language: Go
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# clui
[](https://pkg.go.dev/github.com/aserto-dev/clui)
[](https://goreportcard.com/report/github.com/aserto-dev/clui)
Command Line User Interface library for building user interfaces that interact with humans.
You can find a more comprehensive example [here](https://github.com/aserto-dev/clui/tree/main/example).
- [clui](#clui)
- [Usage](#usage)
- [Printing messages](#printing-messages)
- [Asking for input](#asking-for-input)
- [Spinner progress](#spinner-progress)
- [Tables](#tables)

## Usage
### Printing messages
```go
ui := clui.NewUI()
ui.Normal().Msg("The quick brown fox jumps over the lazy dog!")
```
### Asking for input
```go
ui := clui.NewUI()
var stringResult string
ui.Normal().
WithAskString("What's your name?", &stringResult).
Do()
```
### Spinner progress
```go
ui := clui.NewUI()
p := ui.Progress("Doing something in the background")
p.Start()
defer p.Stop()
time.Sleep(5 * time.Second)
```
### Tables
```go
ui := clui.NewUI()
ui.Normal().WithTable("#", "Name", "Age", "Link").
WithTableRow("1", "Stephen J. Fry", "20", "https://aserto.com").Do()
```