Documentation
¶
Index ¶
- Variables
- func IsInteractive() bool
- func ReadKey(prompt ...string) (rune, error)
- func ReadKeyOf(prompt string, keys ...rune) (rune, error)
- func ReadKeyOfSilent(prompt string, keys ...rune) (rune, error)
- func ReadKeyOrDefaultOf(prompt string, def rune, others ...rune) (rune, error)
- func ReadKeyOrDefaultOfSilent(prompt string, def rune, others ...rune) (rune, error)
- func ReadKeySilent(prompt ...string) (rune, error)
- func ReadLine(prompt string) (string, error)
- func ReadPrompt(ctx context.Context, contr Controller) (string, error)
- type Controller
- type ControllerMode
- type Printer
- type Static
Constants ¶
This section is empty.
Variables ¶
var Error = color.New()
var Logo = color.New(color.FgHiBlack)
var Muted = color.New(color.FgHiBlack)
var Spinner = spinnerCore{ // contains filtered or unexported fields }
Functions ¶
func IsInteractive ¶
func IsInteractive() bool
func ReadKey ¶
ReadKey writes the prompt to the terminal and waits for a single key press. It returns the key pressed as a rune, handling multi-byte characters, and echoes it.
func ReadKeyOf ¶
ReadKeyOf writes the prompt and waits for a key press that matches one of the provided runes. It keeps prompting until a valid key is pressed, echoes it, and returns that rune.
func ReadKeyOfSilent ¶
ReadKeyOfSilent writes the prompt and waits for a key press that matches one of the provided runes silently. It keeps prompting until a valid key is pressed and returns that rune.
func ReadKeyOrDefaultOf ¶
ReadKeyOrDefaultOf writes the prompt and waits for a key press that matches one of the provided runes. If the Enter key (rune '\r') is pressed, it echoes and returns the default rune.
func ReadKeyOrDefaultOfSilent ¶
ReadKeyOrDefaultOfSilent writes the prompt and waits for a key press that matches one of the provided runes silently. If the Enter key (rune '\r') is pressed, it returns the default rune.
func ReadKeySilent ¶
ReadKeySilent writes the prompt to the terminal and waits for a single key press silently. It returns the key pressed as a rune, handling multi-byte characters.
func ReadPrompt ¶ added in v0.0.2
func ReadPrompt(ctx context.Context, contr Controller) (string, error)
Types ¶
type Controller ¶ added in v0.0.2
type ControllerMode ¶ added in v0.0.2
type Printer ¶ added in v0.0.2
type Printer struct {
// contains filtered or unexported fields
}
func NewPrinter ¶ added in v0.0.2
func NewPrinter() *Printer