Documentation
¶
Overview ¶
Package ysmrr provides a simple interface for creating and managing multiple spinners.
Index ¶
- type Option
- func WithCharMap(chars []string) Option
- func WithCompleteColor(c colors.Color) Option
- func WithErrorColor(c colors.Color) Option
- func WithFrameDuration(d time.Duration) Option
- func WithMessageColor(c colors.Color) Option
- func WithSpinnerColor(c colors.Color) Option
- func WithWriter(w io.Writer) Option
- type Spinner
- type SpinnerManager
- type SpinnerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*spinnerManager)
Option represents a spinner manager option.
func WithCharMap ¶
WithCharMap sets the characters used for the spinners. Available charmaps can be found in the package github.com/chelnak/ysmrr/pkg/charmap. The default charmap is the Dots.
func WithCompleteColor ¶ added in v0.0.5
WithCompleteColor sets the color of the complete icon. Available colors can be found in the package github.com/chelnak/ysmrr/pkg/colors. The default color is FgHiGreen.
func WithErrorColor ¶ added in v0.0.5
WithErrorColor sets the color of the error icon. Available colors can be found in the package github.com/chelnak/ysmrr/pkg/colors. The default color is FgHiRed.
func WithFrameDuration ¶
WithFrameDuration sets the duration of each frame. The default duration is 250 milliseconds.
func WithMessageColor ¶ added in v0.0.6
WithMessageColor sets the color of the message. Available colors can be found in the package github.com/chelnak/ysmrr/pkg/colors. The default color is NoColor.
func WithSpinnerColor ¶
WithSpinnerColor sets the color of the spinners. Available colors can be found in the package github.com/chelnak/ysmrr/pkg/colors. The default color is FgHiGreen.
func WithWriter ¶
WithWriter sets the writer used for the spinners. The writer can be anything that implements the io.Writer interface. The default writer is os.Stdout.
type Spinner ¶ added in v0.0.5
type Spinner struct {
// contains filtered or unexported fields
}
Spinner manages a single spinner
func NewSpinner ¶
func NewSpinner(options SpinnerOptions) *Spinner
NewSpinner creates a new spinner instance.
func (*Spinner) Complete ¶ added in v0.0.5
func (s *Spinner) Complete()
Complete marks the spinner as complete.
func (*Spinner) GetMessage ¶ added in v0.0.5
GetMessage returns the current spinner message.
func (*Spinner) IsComplete ¶ added in v0.0.5
IsComplete returns true if the spinner is complete.
func (*Spinner) UpdateMessage ¶ added in v0.0.5
UpdateMessage updates the spinner message.
type SpinnerManager ¶
type SpinnerManager interface {
AddSpinner(msg string) *Spinner
GetSpinners() []*Spinner
GetWriter() io.Writer
GetCharMap() []string
GetFrameDuration() time.Duration
GetSpinnerColor() colors.Color
GetErrorColor() colors.Color
GetCompleteColor() colors.Color
GetMessageColor() colors.Color
Start()
Stop()
}
SpinnerManager manages spinners
func NewSpinnerManager ¶
func NewSpinnerManager(options ...Option) SpinnerManager
NewSpinnerManager creates a new spinner manager.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
advanced
command
|
|
|
basic
command
|
|
|
basic_with_config
command
|
|
|
multiple_spinners
command
|
|
|
pkg
|
|
|
charmap
Package charmap provides a collection of character maps to be used with a spinner.
|
Package charmap provides a collection of character maps to be used with a spinner. |
|
colors
Package colors provides a collection of color definitions for use with a spinner.
|
Package colors provides a collection of color definitions for use with a spinner. |
|
tput
Package tput provides convenience functions for sending escape sequences to the terminal.
|
Package tput provides convenience functions for sending escape sequences to the terminal. |
