output

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTermSize

func GetTermSize(out io.Writer) (int, int)
func MenuModel(m map[models.ModelEnum]string, selected models.ModelEnum) models.ModelEnum

TODO: create in menu a NewMenu that receives titles and items[names, values] and returns a menu

func MenuProfile(profiles map[string]string, selected string) string

Types

type Color

type Color string
const (
	Reset   Color = "\033[0m"
	Red     Color = "\033[31m"
	Green   Color = "\033[32m"
	Yellow  Color = "\033[33m"
	Blue    Color = "\033[34m"
	Magenta Color = "\033[35m"
	Cyan    Color = "\033[36m"
	Gray    Color = "\033[37m"
	White   Color = "\033[97m"

	BgWhite  Color = "\033[107m"
	BgCyan   Color = "\033[46m"
	BgYellow Color = "\033[43m"
)

func (Color) String

func (c Color) String() string
type Menu struct {
	Prompt    string
	CursorPos int
	MenuItems []*MenuItem
}

func NewMenu

func NewMenu(prompt string) *Menu
func (m *Menu) AddItem(option string, id string) *Menu
func (m *Menu) Display(selectedIdx int) string
type MenuItem struct {
	Text    string
	ID      string
	SubMenu *Menu
}

type Printer

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

func NewPrinter

func NewPrinter(stdOut io.Writer, stdErr io.Writer) *Printer

func (*Printer) Print

func (p *Printer) Print(message string, color Color)

func (*Printer) PrintLine

func (p *Printer) PrintLine(color Color)

func (*Printer) PrintWithCodeStyling

func (p *Printer) PrintWithCodeStyling(answer string, codeColor Color)

type Question added in v0.1.3

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

func NewQuestion added in v0.1.3

func NewQuestion(input string) *Question

func (*Question) Ask added in v0.1.3

func (q *Question) Ask(p *Printer) string

func (*Question) WithColor added in v0.1.3

func (q *Question) WithColor(color Color) *Question

func (*Question) WithPrevious added in v0.1.3

func (q *Question) WithPrevious(previousValue string, IsMasked bool) *Question

type Spinner added in v0.1.0

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

func NewSpinner added in v0.1.0

func NewSpinner(message string) *Spinner

func (*Spinner) Start added in v0.1.0

func (s *Spinner) Start()

func (*Spinner) Stop added in v0.1.0

func (s *Spinner) Stop()

Jump to

Keyboard shortcuts

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