https://github.com/theyakka/tardy
Deal with CLI prompts in style
https://github.com/theyakka/tardy
cli go golang prompt terminal
Last synced: about 1 year ago
JSON representation
Deal with CLI prompts in style
- Host: GitHub
- URL: https://github.com/theyakka/tardy
- Owner: theyakka
- License: other
- Created: 2016-07-22T04:44:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-01-03T22:17:51.000Z (over 7 years ago)
- Last Synced: 2025-03-23T18:11:28.147Z (over 1 year ago)
- Topics: cli, go, golang, prompt, terminal
- Language: Go
- Size: 17.6 KB
- Stars: 40
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Tardy is an easy to use, but highly configurable, CLI / terminal prompt library for Go.
[](https://golang.org/)
[](https://travis-ci.org/theyakka/tardy)
[](https://coveralls.io/github/theyakka/tardy?branch=master)
[](http://godoc.org/github.com/theyakka/tardy)
# Features
What can tardy do? Lots!
- Simple, straightforward prompt mechanism
- Per-prompt return values or catch-all so you can check all prompts at the end
- Built in `Prompt` types for common use-cases
- Open-ended string values
- Yes / No values
- Pick from list of possible values
- Retry values that don't meet criteria or are not supplied (if not optional)
- Optionality and default prompt values
- Case sensitive (or insensitive) matching
- Extensible `Prompt` struct so you're not constrained when you need a custom input type with the following features:
- Prompt validation function
- Value conversion function (from string to whatever you want)
# Installing
To install, run:
```
go get -u github.com/theyakka/tardy
```
You can then import tardy using:
```
import github.com/theyakka/tardy
```
# Getting started
This is a super simple overview. If you want to really understand Tardy, we suggest you check out the [Tardy Guide](https://github.com/theyakka/tardy/wiki).
Anyhow, let's run through a super simple example.
```go
p := tardy.NewPrompter()
p.Prompt(tardy.SimplePrompt("What is your name?", tardy.Required, ""))
fmt.Println("Your name is:", p.IndexedValues[0])
```
When run, you will see a prompt. After entering a value you should see something like the following:
```
What is your name?: John Smith
Your name is: John Smith
```
# FAQ
## Why should I use this and not ____?
Why not?
We designed this library because nothing else fit our needs. If it fits yours, cool. If not, we won't hold it against you if you use something else.
Give it a try and if you like it, let us know! Either way, we love feedback.
## Has it been tested in production? Can I use it in production?
The code here has been written based on Yakka's experiences with clients of all sizes. It has been production tested. That said, code is always evolving. We plan to keep on using it in production but we also plan to keep on improving it. If you find a bug, let us know!
# Outro
## Credits
Tardy is sponsored, owned and maintained by [Yakka LLC](https://theyakka.com). Follow us on Twitter [@yakkallc](https://twitter.com/yakkallc). Feel free to reach out with suggestions, ideas or to say hey.
### Security
If you believe you have identified a serious security vulnerability or issue with Tardy, please report it as soon as possible to apps@theyakka.com. Please refrain from posting it to the public issue tracker so that we have a chance to address it and notify everyone accordingly.
## License
Tardy is released under a modified MIT license. See LICENSE for details.
Tardy is a Yakka original.