termx

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error = color.New()

Functions

func IsInteractive

func IsInteractive() bool

func ReadKey

func ReadKey(prompt ...string) (rune, error)

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

func ReadKeyOf(prompt string, keys ...rune) (rune, error)

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

func ReadKeyOfSilent(prompt string, keys ...rune) (rune, error)

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

func ReadKeyOrDefaultOf(prompt string, def rune, others ...rune) (rune, error)

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

func ReadKeyOrDefaultOfSilent(prompt string, def rune, others ...rune) (rune, error)

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

func ReadKeySilent(prompt ...string) (rune, error)

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 ReadLine

func ReadLine(prompt string) (string, error)

ReadLine reads a line from the terminal based on a prompt

func ReadSecret

func ReadSecret(prompt string) (string, error)

ReadSecret reads a secret from the terminal without echoing it.

func SpinnerStart

func SpinnerStart()

func SpinnerStop

func SpinnerStop()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳