asky

package module
v0.0.0-...-abce238 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 14 Imported by: 0

README

ASKY - Simple TUI Prompt Library for Go

Documentation

Index

Constants

View Source
const (
	AlignLeft alignment = iota
	AlignCenter
	AlignRight
)
View Source
const (
	StatusLevelDebug statusLevel = iota
	StatusLevelSuccess
	StatusLevelInfo
	StatusLevelWarn
	StatusLevelError
)

Variables

View Source
var ErrInterrupted = errors.New("prompt interrupted")
View Source
var ErrInvalidSelectionCount = errors.New("max count > min count for multi select prompt")
View Source
var ErrNoSelectionChoices = errors.New("no choices supplied for selection prompt")
View Source
var ErrTerminalTooSmall = errors.New("terminal dimensions too small")
View Source
var ProgressPatternDefault = ProgressPattern{"+", "-", " [", "] "}

--- Presets ---------------------------------------------

View Source
var ProgressPatternHashes = ProgressPattern{"#", "=", " [", "] "}
View Source
var ProgressPatternPipes = ProgressPattern{"|", " ", " ", " "}
View Source
var ProgressPatternSolid = ProgressPattern{"█", "░", " ", " "}
View Source
var SpinnerPatternCircles = []string{"◐ ", "◓ ", "◑ ", "◒ "}
View Source
var SpinnerPatternDefault = []string{"[⠋] ", "[⠙] ", "[⠹] ", "[⠸] ", "[⠼] ", "[⠴] ", "[⠦] ", "[⠧] ", "[⠇] ", "[⠏] "}

--- Presets ---------------------------------------------

View Source
var SpinnerPatternDots = []string{"⣾ ", "⣽ ", "⣻ ", "⢿ ", "⡿ ", "⣟ ", "⣯ ", "⣷ "}
View Source
var SpinnerPatternDotsMini = []string{"⠋ ", "⠙ ", "⠹ ", "⠸ ", "⠼ ", "⠴ ", "⠦ ", "⠧ ", "⠇ ", "⠏ "}
View Source
var SpinnerPatternLine = []string{"- ", "\\ ", "| ", "/ "}
View Source
var SpinnerPatternMoons = []string{"🌑 ", "🌒 ", "🌓 ", "🌔 ", "🌕 ", "🌖 ", "🌗 ", "🌘 "}
View Source
var SpinnerPatternPipes = []string{"╾ ", "│ ", "╸ ", "┤ ", "├ ", "└ ", "┴ ", "┬ ", "┐ ", "┘ "}
View Source
var SpinnerPatternSquares = []string{"▖ ", "▌ ", "▘ ", "▀ ", "▝ ", "▐ ", "▗ ", "▄ "}

Functions

func NewBanner

func NewBanner() *banner

--- Initialization --------------------------------------

func NewMultiSelect

func NewMultiSelect() *multiSelect

--- Initiation ------------------------------------------

func NewProgress

func NewProgress() *progress

--- Initiation ------------------------------------------

func NewSecureInput

func NewSecureInput() *secureInput

--- Initiation ------------------------------------------

func NewSingleSelect

func NewSingleSelect() *singleSelect

--- Initiation ------------------------------------------

func NewSpinner

func NewSpinner() *spinner

--- Initiation ------------------------------------------

func NewStatus

func NewStatus() *status

--- Initialization --------------------------------------

func NewTextInput

func NewTextInput() *textInput

--- Initiation ------------------------------------------

Types

type Choice

type Choice struct {
	Value    string
	Label    string
	Disabled bool
}

--- Definition ------------------------------------------

type ProgressPattern

type ProgressPattern struct {
	DoneChar, PendingChar   string
	BarPadLeft, BarPadRight string
}

--- Definition -------------------------------------------

type StyleMap

type StyleMap struct {

	// Status Messages
	StatusSuccessPrefix *termicolr.Style
	StatusSuccessLabel  *termicolr.Style
	StatusDebugPrefix   *termicolr.Style
	StatusDebugLabel    *termicolr.Style
	StatusInfoPrefix    *termicolr.Style
	StatusInfoLabel     *termicolr.Style
	StatusWarnPrefix    *termicolr.Style
	StatusWarnLabel     *termicolr.Style
	StatusErrorPrefix   *termicolr.Style
	StatusErrorLabel    *termicolr.Style

	// Banners
	BannerLabel           *termicolr.Style
	BannerLabelPadChar    *termicolr.Style
	BannerSubLabel        *termicolr.Style
	BannerSubLabelPadChar *termicolr.Style

	// Input Prompts
	InputDesc           *termicolr.Style
	InputPrefix         *termicolr.Style
	InputLabel          *termicolr.Style
	InputPlaceholder    *termicolr.Style
	InputText           *termicolr.Style
	InputValidationPass *termicolr.Style
	InputValidationFail *termicolr.Style
	InputHelp           *termicolr.Style

	// Confirmation Prompts
	ConfirmationPrefix         *termicolr.Style
	ConfirmationLabel          *termicolr.Style
	ConfirmationDesc           *termicolr.Style
	ConfirmationHelp           *termicolr.Style
	ConfirmationSelectedItem   *termicolr.Style
	ConfirmationUnselectedItem *termicolr.Style

	// Selection Prompts
	SelectionPrefix             *termicolr.Style
	SelectionLabel              *termicolr.Style
	SelectionDesc               *termicolr.Style
	SelectionHelp               *termicolr.Style
	SelectionSearchLabel        *termicolr.Style
	SelectionSearchHint         *termicolr.Style
	SelectionValidationPass     *termicolr.Style
	SelectionValidationFail     *termicolr.Style
	SelectionListItemHeader     *termicolr.Style
	SelectionListItemLabel      *termicolr.Style
	SelectionCurrentItemMarker  *termicolr.Style
	SelectionCurrentItemLabel   *termicolr.Style
	SelectionSelectedItemMarker *termicolr.Style
	SelectionSelectedItemLabel  *termicolr.Style
	SelectionDisabledItemMarker *termicolr.Style
	SelectionDisabledItemLabel  *termicolr.Style

	// Spinners
	SpinnerPrefix *termicolr.Style
	SpinnerLabel  *termicolr.Style
	SpinnerDesc   *termicolr.Style

	// Progress Bars
	ProgressPrefix     *termicolr.Style
	ProgressLabel      *termicolr.Style
	ProgressDesc       *termicolr.Style
	ProgressBarPad     *termicolr.Style
	ProgressBarDone    *termicolr.Style
	ProgressBarPending *termicolr.Style
	ProgressBarStatus  *termicolr.Style
	// contains filtered or unexported fields
}

Styling for Asky TUI components (uses termicolr styles).

func StyleMapDefault

func StyleMapDefault(theme *termicolr.Theme) *StyleMap

DefaultScheme creates a preconfigured scheme based on the given theme.

Jump to

Keyboard shortcuts

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