Skip to content

Commit

Permalink
removing console colors from non-darwin systems (#114)
Browse files Browse the repository at this point in the history
* removing console colors from non-darwin systems
  • Loading branch information
a-thaler committed Jun 11, 2019
1 parent bc261e3 commit dd4904a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 3 additions & 1 deletion internal/step/factory.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package step

import "runtime"
import (
"runtime"
)

type Factory struct {
NonInteractive bool
Expand Down
10 changes: 3 additions & 7 deletions internal/step/glyphs.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package step

import (
"github.com/fatih/color"
)

var (
successGlyph = color.GreenString("✓ ")
failureGlyph = color.RedString("✕ ")
warningGlyph = color.YellowString("! ")
successGlyph = "- "
failureGlyph = "X "
warningGlyph = "! "
questionGlyph = "? "
infoGlyph = " "
)
9 changes: 5 additions & 4 deletions internal/step/spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/briandowns/spinner"
"github.com/fatih/color"
)

func newStepWithSpinner(msg string) Step {
Expand Down Expand Up @@ -58,9 +59,9 @@ func (s *stepWithSpinner) Stopf(success bool, format string, args ...interface{}
func (s *stepWithSpinner) Stop(success bool) {
var gliph string
if success {
gliph = successGlyph
gliph = color.GreenString(successGlyph)
} else {
gliph = failureGlyph
gliph = color.RedString(failureGlyph)
}
s.spinner.FinalMSG = fmt.Sprintf("%s%s\n", gliph, s.msg)
s.spinner.Stop()
Expand All @@ -75,11 +76,11 @@ func (s *stepWithSpinner) LogInfof(format string, args ...interface{}) {
}

func (s *stepWithSpinner) LogError(msg string) {
s.logTof(os.Stderr, warningGlyph+msg)
s.logTof(os.Stderr, color.YellowString(warningGlyph)+msg)
}

func (s *stepWithSpinner) LogErrorf(format string, args ...interface{}) {
s.logTof(os.Stderr, warningGlyph+format, args)
s.logTof(os.Stderr, color.YellowString(warningGlyph)+format, args)
}

func (s *stepWithSpinner) logTof(to io.Writer, format string, args ...interface{}) {
Expand Down

0 comments on commit dd4904a

Please sign in to comment.