promptkit

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2021 License: MIT Imports: 0 Imported by: 9

README

Promptkit

Go Reference

Promptkit is a collection of common command line prompts for interactive programs. Each prompts comes with sensible defaults, re-mappable key bindings and many opportunities for heavy customization.

Selection

Selection with filter and pagination support:

asciicast

https://github.com/erikgeiser/promptkit/blob/ea17c82a1ba5299a2eb2b00bc1b1b5baf4e52a5e/examples/selection/main.go#L11-L15

The selection prompt is highly customizable and also works well with custom types which for example enables filtering only on custom fields:

asciicast

https://github.com/erikgeiser/promptkit/blob/ea17c82a1ba5299a2eb2b00bc1b1b5baf4e52a5e/examples/selection_custom/main.go#L55-L70

Text Input

A text input that supports editable default values:

asciicast

https://github.com/erikgeiser/promptkit/blob/f29e12dd8eb290771e9652a0eda6cac0e3895976/examples/textinput/main.go#L11-L16

Custom validation is also supported:

asciicast

https://github.com/erikgeiser/promptkit/blob/f29e12dd8eb290771e9652a0eda6cac0e3895976/examples/textinput_custom/main.go#L18-L24

The text input can also be used in hidden mode for password prompts:

asciicast

https://github.com/erikgeiser/promptkit/blob/f29e12dd8eb290771e9652a0eda6cac0e3895976/examples/textinput_hidden/main.go#L11-L17

Confirmation Prompt

A confirmation prompt for binary questions is coming soon.

Documentation

Overview

Package promptkit is a collection of common command line prompts for interactive programs. Each prompts comes with sensible defaults, re-mappable key bindings and many opportunities for heavy customization.

Directories

Path Synopsis
examples
Package selection implements a selection prompt that allows users to to select one of the pre-defined choices.
Package selection implements a selection prompt that allows users to to select one of the pre-defined choices.
Package textinput implements prompt for a string input that can also be used for secret strings such as passwords.
Package textinput implements prompt for a string input that can also be used for secret strings such as passwords.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL