ux

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Doc = newDocument(os.Stdout)

Doc global document

View Source
var DotSpinner = NewDotSpinner(os.Stdout)

DotSpinner dot spinner

Functions

func Prompt

func Prompt(text string) (bool, error)

Prompt confirm

Types

type Block

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

Block in document, including a spinner and some text

func NewBlock

func NewBlock() *Block

NewBlock create a new Block without spinner. block.Stable closed

func NewSpinBlock

func NewSpinBlock(s *Spin) *Block

NewSpinBlock create a new Block with spinner

func (*Block) Append

func (b *Block) Append(text string)

Append text to Block

func (*Block) SetSpin

func (b *Block) SetSpin(s *Spin) error

SetSpin set spin for block

func (*Block) Update

func (b *Block) Update(text string, index int)

Update lines in Block

type Refresh

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

Refresh 刷新显示文本

func NewRefresh

func NewRefresh() *Refresh

NewRefresh create a new Refresh instance

func (*Refresh) Do

func (r *Refresh) Do(text string)

Do 刷新显示

type Spin

type Spin struct {
	DoingText   string
	DoneText    string
	TimeoutText string
	// contains filtered or unexported fields
}

Spin type

func NewDotSpin

func NewDotSpin(out io.Writer, doingText string) *Spin

NewDotSpin get new DotSpinner instance

func (*Spin) Stop

func (s *Spin) Stop()

Stop stop render

func (*Spin) Timeout

func (s *Spin) Timeout()

Timeout stop render

type Spinner

type Spinner struct {
	DoingText   string
	DoneText    string
	TimeoutText string
	// contains filtered or unexported fields
}

Spinner type

func NewDotSpinner

func NewDotSpinner(out io.Writer) *Spinner

NewDotSpinner get new DotSpinner instance

func (*Spinner) Fail

func (s *Spinner) Fail(err error)

Fail stop render

func (*Spinner) Start

func (s *Spinner) Start(doingText string)

Start start render

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop stop render

func (*Spinner) Timeout

func (s *Spinner) Timeout()

Timeout stop render

Jump to

Keyboard shortcuts

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