Skip to content

Getting Started

Luke edited this page Jul 23, 2016 · 3 revisions

Whats a prompter? What does this do?

Tardy allows you to capture information from your users via prompts within the terminal CLI. An example of what you would see is something like:

What is your name?:  John Smith
Hello John Smith

The user sees a prompt asking What is your name?:, they enter their name and hit enter. The program then responds with a message Hello John Smith (or whatever name is provided). Tardy deals with the first parts: prompting for input and capturing it so you can use it in your application logic.

Whats Included?

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/goposse/tardy

You can then import tardy using:

import github.com/goposse/tardy

You should be good to go!

Clone this wiki locally