From 624c1121762378cc528349f222c96773aa911733 Mon Sep 17 00:00:00 2001 From: mitch Date: Fri, 31 Dec 2021 02:17:42 -0500 Subject: [PATCH] Improved notifications Added progress indicator in clone output --- clone.go | 6 +++++- wipe.go | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/clone.go b/clone.go index 7e962b2..da9da68 100644 --- a/clone.go +++ b/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() } diff --git a/wipe.go b/wipe.go index df045db..2ed4f33 100644 --- a/wipe.go +++ b/wipe.go @@ -70,6 +70,7 @@ func writeToDisk(wipeDisk string, blocksize int, writeType string) { } _, err = fTarget.Write(block[:n]) } + fmt.Println("Performing sync operations...") fTarget.Sync() }