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.
The actual prompt components can be found in the sub directories.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAborted = fmt.Errorf("prompt aborted")
ErrAborted is returned when the prompt was aborted.
Functions ¶
func UtilFuncMap ¶
UtilFuncMap returns a template.FuncMap with handy utility functions for prompt templates.
- Repeat(string, int) string: Identical to strings.Repeat.
- Len(string): reflow/ansi.PrintableRuneWidth, Len works like len but is aware of ansi codes and returns the length of the string as it appears on the screen.
- Min(int, int) int: The minimum of two ints.
- Max(int, int) int: The maximum of two ints.
- Add(int, int) int: The sum of two ints.
- Sub(int, int) int: The difference of two ints.
- Mul(int, int) int: The product of two ints.
Types ¶
Directories ¶
Path | Synopsis |
---|---|
Package confirmation implements prompt for a binary confirmation such as a yes/no question.
|
Package confirmation implements prompt for a binary confirmation such as a yes/no question. |
examples
|
|
bubbletea_widget
Package main demonstrates how promptkit can be used as a bubbletea widget.
|
Package main demonstrates how promptkit can be used as a bubbletea widget. |
confirmation
Package main demonstrates how promptkit/confirmation is used.
|
Package main demonstrates how promptkit/confirmation is used. |
confirmation_custom
Package main demonstrates how promptkit/confirmation can be customized.
|
Package main demonstrates how promptkit/confirmation can be customized. |
selection
Package main demonstrates how promptkit/selection is used.
|
Package main demonstrates how promptkit/selection is used. |
selection_custom
Package main demonstrates how promptkit/selection can be customized.
|
Package main demonstrates how promptkit/selection can be customized. |
textinput
Package main demonstrates how promptkit/textinput is used.
|
Package main demonstrates how promptkit/textinput is used. |
textinput_custom
Package main demonstrates how promptkit/textinput can be customized.
|
Package main demonstrates how promptkit/textinput can be customized. |
textinput_hidden
Package main demonstrates how promptkit/textinput can be used to ask for passphrases.
|
Package main demonstrates how promptkit/textinput can be used to ask for passphrases. |
Package selection implements a selection prompt that allows users to select one of the pre-defined choices.
|
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 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.
|
Package textinput implements prompt for a string input that can also be used for secret strings such as passwords. |
Click to show internal directories.
Click to hide internal directories.