mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Fixed #3
This commit is contained in:
parent
291aae18f3
commit
cc549c817f
4 changed files with 49 additions and 36 deletions
|
|
@ -11,7 +11,7 @@ import (
|
|||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -19,7 +19,7 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
var sessionIDPath = path.Join(os.TempDir(), ".crunchy")
|
||||
var sessionIDPath = filepath.Join(os.TempDir(), ".crunchy")
|
||||
|
||||
type progress struct {
|
||||
status bool
|
||||
|
|
@ -89,11 +89,20 @@ func (l *logger) StartProgress(message string) {
|
|||
l.progressWG.Lock()
|
||||
select {
|
||||
case p := <-l.progress:
|
||||
fmt.Print("\r")
|
||||
// clearing the last line
|
||||
fmt.Printf("\r%s\r", strings.Repeat(" ", len(l.InfoLog.Prefix())+len(message)+2))
|
||||
if p.status {
|
||||
l.InfoLog.Printf("✅ %s", p.message)
|
||||
successTag := "✔"
|
||||
if runtime.GOOS == "windows" {
|
||||
successTag = "~"
|
||||
}
|
||||
l.InfoLog.Printf("%s %s", successTag, p.message)
|
||||
} else {
|
||||
l.ErrLog.Printf("❌ %s", p.message)
|
||||
errorTag := "✘"
|
||||
if runtime.GOOS == "windows" {
|
||||
errorTag = "!"
|
||||
}
|
||||
l.ErrLog.Printf("%s %s", errorTag, p.message)
|
||||
}
|
||||
l.progress = nil
|
||||
l.progressWG.Unlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue