Merge pull request #1173 from harshavardhana/cursor-animate

Add cursor animate to mirror
This commit is contained in:
Harshavardhana
2015-10-08 16:35:53 -07:00
2 changed files with 22 additions and 22 deletions
-22
View File
@@ -19,7 +19,6 @@ package main
import (
"encoding/json"
"strings"
"time"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/console"
@@ -232,27 +231,6 @@ func dodiffRecursive(firstClnt, secondClnt client.Client, ch chan DiffMessage) {
return
}
doneCh := make(chan bool)
defer close(doneCh)
go func(doneCh <-chan bool) {
cursorCh := cursorAnimate()
for {
select {
case <-time.Tick(100 * time.Millisecond):
if !globalQuietFlag && !globalJSONFlag {
console.PrintC("\r" + "Scanning.. " + string(<-cursorCh))
}
case <-doneCh:
return
}
}
}(doneCh)
doneCh <- true
if !globalQuietFlag && !globalJSONFlag {
console.Eraseline()
}
fch := firstClnt.List(true)
sch := secondClnt.List(true)
f, fok := <-fch
+22
View File
@@ -20,9 +20,11 @@ import (
"fmt"
"strconv"
"strings"
"time"
"github.com/minio/cli"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/console"
"github.com/minio/minio/pkg/probe"
)
@@ -102,6 +104,22 @@ func deltaSourceTargets(sourceClnt client.Client, targetClnts []client.Client) <
defer close(mirrorURLsCh)
id := newRandomID(8)
doneCh := make(chan bool)
defer close(doneCh)
go func(doneCh <-chan bool) {
cursorCh := cursorAnimate()
for {
select {
case <-time.Tick(100 * time.Millisecond):
if !globalQuietFlag && !globalJSONFlag {
console.PrintC("\r" + "Scanning.. " + string(<-cursorCh))
}
case <-doneCh:
return
}
}
}(doneCh)
sourceSortedList := sortedList{}
targetSortedList := make([]*sortedList, len(targetClnts))
@@ -161,6 +179,10 @@ func deltaSourceTargets(sourceClnt client.Client, targetClnts []client.Client) <
}
}
}
doneCh <- true
if !globalQuietFlag && !globalJSONFlag {
console.Eraseline()
}
}()
return mirrorURLsCh
}