console

package
v2.0.26 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UsePrettyPrompts = runtime.GOOS != "windows"

Windows (powershell, cygwin, git bash) aren't propertly supported with pretty prompts (promptui or huh) So we'll use raw reads for these "dumb" terminals

Functions

func Errorln

func Errorln(format string, a ...any) error

func PrintSeparateln

func PrintSeparateln(format string, a ...any)

func Println

func Println(format string, a ...any)

Types

type Input

type Input struct {
	// contains filtered or unexported fields
}

func NewInput

func NewInput() *Input

func (*Input) Prompt

func (i *Input) Prompt(prompt string) *Input

func (*Input) Run

func (i *Input) Run() error

func (*Input) Title

func (i *Input) Title(title string) *Input

func (*Input) Validate

func (i *Input) Validate(validate func(string) error) *Input

func (*Input) Value

func (i *Input) Value(value *string) *Input

type Option

type Option[T comparable] struct {
	Title string
	Value T
}

func NewOption

func NewOption[T comparable](title string, value T) Option[T]

type Select

type Select[T comparable] struct {
	// contains filtered or unexported fields
}

func NewSelect

func NewSelect[T comparable]() *Select[T]

func (*Select[T]) Options

func (s *Select[T]) Options(optionsArray []T) *Select[T]

func (*Select[T]) Prompt

func (s *Select[T]) Prompt(prompt string) *Select[T]

func (*Select[T]) Run

func (s *Select[T]) Run() error

func (*Select[T]) Title

func (s *Select[T]) Title(title string) *Select[T]

func (*Select[T]) Value

func (s *Select[T]) Value(value *T) *Select[T]

Jump to

Keyboard shortcuts

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