Improved notifications
Added progress indicator in clone output
This commit is contained in:
parent
e77ab09050
commit
624c112176
6
clone.go
6
clone.go
@ -10,6 +10,7 @@ package main
|
||||
*/
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
@ -31,7 +32,7 @@ func clone(cloneBs int, cloneSource string, cloneTarget string) {
|
||||
}
|
||||
defer fTarget.Close()
|
||||
errorHandler(err)
|
||||
//todo progress indicator
|
||||
progress := cloneBs
|
||||
for {
|
||||
n, err := fSource.Read(p)
|
||||
if err == io.EOF {
|
||||
@ -42,6 +43,9 @@ func clone(cloneBs int, cloneSource string, cloneTarget string) {
|
||||
errorHandler(err)
|
||||
_, err = fTarget.Write(p[:n])
|
||||
errorHandler(err)
|
||||
fmt.Println(progress/1048576, "MB written...")
|
||||
progress += cloneBs
|
||||
}
|
||||
fmt.Println("Performing sync operations...")
|
||||
fTarget.Sync()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user