Categorygithub.com/erikgeiser/promptkit
modulepackage
0.9.0
Repository: https://github.com/erikgeiser/promptkit.git
Documentation: pkg.go.dev

# README

promptkit

Interactive command line prompts with style!

Release Go Doc GitHub Action: Build
GitHub Action: Check Software License Go Report Card

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.


Disclaimers:


Selection

Selection with filter and pagination support: Example Code


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


Text Input

A text input that supports editable default values: Example Code


Custom validation is also supported: Example Code


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


Confirmation Prompt

A confirmation prompt for binary questions: Example Code

Widget

The prompts in this library can also be used as bubbletea widgets: Example Code

Acknowledgements

This library is built on top of many great libraries, especially the following:

# Packages

Package confirmation implements prompt for a binary confirmation such as a yes/no question.
No description provided by the author
Package selection implements a selection prompt that allows users to select one of the pre-defined choices.
Package test contains helper functions for prompt tests.
Package textinput implements prompt for a string input that can also be used for secret strings such as passwords.

# Functions

HardWrap performs a hard wrap at the given width.
Truncate cuts the string after the given width.
UtilFuncMap returns a template.FuncMap with handy utility functions for prompt templates.
WordWrap performs a word wrap on the input and forces a wrap at width if a word is still larger that width after soft wrapping.

# Variables

ErrAborted is returned when the prompt was aborted.

# Type aliases

WrapMode decides in which way text is wrapped.