mirror of
https://github.com/esimov/caire.git
synced 2025-10-12 12:00:14 +08:00
utils: hide the cursor on progress indicator
This commit is contained in:
@@ -99,7 +99,8 @@ func main() {
|
||||
spinnerText := fmt.Sprintf("%s %s",
|
||||
utils.DecorateText("⚡ CAIRE", utils.StatusMessage),
|
||||
utils.DecorateText("is resizing the image...", utils.DefaultMessage))
|
||||
spinner = utils.NewSpinner(spinnerText, time.Millisecond*200, true)
|
||||
|
||||
spinner = utils.NewSpinner(spinnerText, time.Millisecond*100)
|
||||
|
||||
if *newWidth > 0 || *newHeight > 0 || *percentage || *square {
|
||||
if *faceDetect && len(*cascade) == 0 {
|
||||
|
@@ -9,6 +9,7 @@ import (
|
||||
func (c *Carver) Grayscale(src *image.NRGBA) *image.NRGBA {
|
||||
dx, dy := src.Bounds().Max.X, src.Bounds().Max.Y
|
||||
dst := image.NewNRGBA(src.Bounds())
|
||||
|
||||
for x := 0; x < dx; x++ {
|
||||
for y := 0; y < dy; y++ {
|
||||
r, g, b, _ := src.At(x, y).RGBA()
|
||||
|
@@ -24,13 +24,13 @@ type Spinner struct {
|
||||
}
|
||||
|
||||
// NewSpinner instantiates a new progress indicator.
|
||||
func NewSpinner(msg string, d time.Duration, hideCursor bool) *Spinner {
|
||||
func NewSpinner(msg string, d time.Duration) *Spinner {
|
||||
return &Spinner{
|
||||
mu: &sync.RWMutex{},
|
||||
delay: d,
|
||||
writer: os.Stderr,
|
||||
message: msg,
|
||||
hideCursor: hideCursor,
|
||||
hideCursor: true,
|
||||
stopChan: make(chan struct{}, 1),
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// MessageType is a placeholder for the various the message types.
|
||||
// MessageType is a custom type used as a placeholder for various message types.
|
||||
type MessageType int
|
||||
|
||||
// The message types used accross the CLI application.
|
||||
|
Reference in New Issue
Block a user