Skip to content

sveltinio/prompti

Repository files navigation

prompti

Lightweight and customizable interactive prompt components for Go based CLI.

license   go report card   go reference   sveltin cli version

prompti is a collection of TUI blocks initially created to be used by sveltin and its use cases. We worked on it to allow customizations and make it available as standalone package. Here it is!

Install

Install the latest version by using the go get command. Ensure to have (Go v1.18 or higher) installed on your machine.

go get github.com/sveltinio/prompti@latest

Prompts

Input

input is a terminal input prompt component supporting default values, validations (type ValidateFunc func(string) error), password input echo and customizable styles.

It also provides ready to use validation functions for some common use cases:

  • alphanumeric
  • digits only
  • integers
  • floats
  • email address
  • url

Default

Source Code

Input example

Default value and validation

Input example with default value and validation

Custom styles

Source Code

Input example with custom styles

Other Examples

Choose

choose is a customizable component for browsing a set of items.

Default

Source Code

Choose example

Custom styles

Source Code

Choose example with custom styles

Confirm

confirm is a customizable component to confirm an anction.

Default

Source Code

Confirm example

Custom styles

Source Code

Confirm example with custom styles

Toggle

toggle is a customizable component to confirm an anction. It works like confirm but it renders the options inline and not in a box.

Default

Source Code

Toggle example

Custom styles

Source Code

Toggle example with custom styles

ProgressBar

progressbar is a customizable component for progress meter.

Default

Source Code

ProgressBar example

Styled

Source Code

ProgressBar example

🆓 License

prompti is free and open-source software licensed under the MIT License.


Made with Charm.