Documentation
¶
Overview ¶
Package spinner Originally created by Brian Downs https://github.com/briandowns/spinner
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package spinner is a simple package to add a spinner / progress indicator to any terminal application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CharSets = map[int][]string{
0: {"⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"},
1: {"⢹", "⢺", "⢼", "⣸", "⣇", "⡧", "⡗", "⡏"},
}
CharSets contains the available character sets
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Spinner)
Option is a function that takes a spinner and applies a given configuration
func WithFinalMSG ¶
WithFinalMSG adds the given string to the spinner as the final message to be written
func WithHiddenCursor ¶
WithHiddenCursor hides the cursor if hideCursor = true given
type Spinner ¶
type Spinner struct {
Delay time.Duration // Delay is the speed of the indicator
Prefix string // Prefix is the text prepended to the indicator
Suffix string // Suffix is the text appended to the indicator
FinalMSG string // string displayed after Stop() is called
Writer io.Writer // to make testing better, exported so users have access
HideCursor bool // hideCursor determines if the cursor is visible
// contains filtered or unexported fields
}
Spinner struct to hold the provided options
func (*Spinner) Unlock ¶
func (s *Spinner) Unlock()
Unlock allows for manual control to unlock the spinner
func (*Spinner) UpdateCharSet ¶
UpdateCharSet will change the current character set to the given one
func (*Spinner) UpdateSpeed ¶
UpdateSpeed will set the indicator delay to the given value