Documentation
¶
Index ¶
- type DynamicSpinner
- type Spinner
- type StaticSpinner
- type Status
- type StatusPrinter
- func (s *StatusPrinter) Debugf(format string, a ...interface{})
- func (s *StatusPrinter) End(success bool)
- func (s *StatusPrinter) InfoStructFields(header string, data any) error
- func (s *StatusPrinter) InfoWithBody(header, body string)
- func (s *StatusPrinter) Infof(format string, a ...interface{})
- func (s *StatusPrinter) Step(stageFmt string, args ...interface{})
- func (s *StatusPrinter) Writer() io.Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamicSpinner ¶
type DynamicSpinner struct {
// contains filtered or unexported fields
}
DynamicSpinner is suitable for smart terminals which support animations (control cursor location, color etc.).
func NewDynamicSpinner ¶
func NewDynamicSpinner(w io.Writer) *DynamicSpinner
NewDynamicSpinner returns a new DynamicSpinner instance.
func (*DynamicSpinner) Active ¶
func (d *DynamicSpinner) Active() bool
Active returns whether the spinner is currently active.
func (*DynamicSpinner) Start ¶
func (d *DynamicSpinner) Start(stage string)
Start activates the spinner with a given name.
func (*DynamicSpinner) Stop ¶
func (d *DynamicSpinner) Stop(msg string)
Stop deactivates the spinner with a given message.
type StaticSpinner ¶
type StaticSpinner struct {
// contains filtered or unexported fields
}
StaticSpinner is suitable for non-smart terminals.
func NewStaticSpinner ¶
func NewStaticSpinner(w io.Writer) *StaticSpinner
NewStaticSpinner returns a new StaticSpinner instance.
func (*StaticSpinner) Active ¶
func (s *StaticSpinner) Active() bool
Active returns whether the spinner is currently active.
func (*StaticSpinner) Start ¶
func (s *StaticSpinner) Start(stage string)
Start activates the spinner with a given name.
func (*StaticSpinner) Stop ¶
func (s *StaticSpinner) Stop(msg string)
Stop deactivates the spinner with a given message.
type Status ¶
type Status interface { Step(stageFmt string, args ...interface{}) End(success bool) Infof(format string, a ...interface{}) InfoWithBody(header, body string) Writer() io.Writer }
Status defines status printer methods. Allows us to use different status printers.
type StatusPrinter ¶
StatusPrinter provides functionality to display steps progress in terminal.
func NewStatus ¶
func NewStatus(w io.Writer, header string) *StatusPrinter
NewStatus returns a new Status instance.
func (*StatusPrinter) Debugf ¶
func (s *StatusPrinter) Debugf(format string, a ...interface{})
Debugf prints a given debug message without spinner animation. It prints it only if verbose flag was specified.
func (*StatusPrinter) End ¶
func (s *StatusPrinter) End(success bool)
End marks started step as completed.
func (*StatusPrinter) InfoStructFields ¶
func (s *StatusPrinter) InfoStructFields(header string, data any) error
InfoStructFields prints a given struct with key-value layout.
func (*StatusPrinter) InfoWithBody ¶
func (s *StatusPrinter) InfoWithBody(header, body string)
InfoWithBody prints a given info with a given body and without spinner animation.
func (*StatusPrinter) Infof ¶
func (s *StatusPrinter) Infof(format string, a ...interface{})
Infof prints a given info without spinner animation.
func (*StatusPrinter) Step ¶
func (s *StatusPrinter) Step(stageFmt string, args ...interface{})
Step starts spinner for a given step.
func (*StatusPrinter) Writer ¶
func (s *StatusPrinter) Writer() io.Writer
Writer returns underlying io.Writer