From e0862ac4ca29c2db684a72bad60f51729c22486d Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 27 Jul 2015 19:05:12 -0700 Subject: [PATCH] Fix progress bar style and cursors for darwin --- pb.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pb.go b/pb.go index e832e979..2ee3f447 100644 --- a/pb.go +++ b/pb.go @@ -100,16 +100,20 @@ func (b barSend) Finish() { func cursorAnimate() <-chan rune { cursorCh := make(chan rune) var cursors string - if runtime.GOOS == "windows" { - cursors = "|/-\\" - } else { + + switch runtime.GOOS { + case "linux": // cursors = "➩➪➫➬➭➮➯➱" // cursors = "▁▃▄▅▆▇█▇▆▅▄▃" cursors = "◐◓◑◒" // cursors = "←↖↑↗→↘↓↙" - // cursors = "⣾⣽⣻⢿⡿⣟⣯⣷" // cursors = "◴◷◶◵" // cursors = "◰◳◲◱" + case "darwin": + cursors = "◐◓◑◒" + //cursors = "⣾⣽⣻⢿⡿⣟⣯⣷" + default: + cursors = "|/-\\" } go func() { for { @@ -154,12 +158,14 @@ func newCpBar() barSend { bar.Callback = func(s string) { console.Bar("\r" + s) } - // cursorCh := cursorAnimate() - if runtime.GOOS == "windows" { - bar.Format("[=> ]") - } else { + switch runtime.GOOS { + case "linux": bar.Format("┃▓█░┃") // bar.Format("█▓▒░█") + case "darwin": + bar.Format(" ▓ ░ ") + default: + bar.Format("[=> ]") } for msg := range cmdCh { switch msg.Cmd {