Skip to content

Commit

Permalink
minor changes on top of latest fixes (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedib0t authored Aug 9, 2021
1 parent f0fe8f9 commit eaf4190
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
16 changes: 6 additions & 10 deletions progress/units.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import (
"fmt"
)

// UnitsNotationPosition determines units position relative of tracker value
// Defaults is UnitsNotationPositionBefore
// UnitsNotationPosition determines units position relative of tracker value.
type UnitsNotationPosition int

// Supported unit positions relative to tracker value
// Supported unit positions relative to tracker value;
// default: UnitsNotationPositionBefore
const (
UnitsNotationPositionBefore UnitsNotationPosition = iota
UnitsNotationPositionAfter
)

// Units defines the "type" of the value being tracked by the Tracker.
type Units struct {
Notation string
Formatter func(value int64) string
Notation string
NotationPosition UnitsNotationPosition
Formatter func(value int64) string
}

var (
Expand Down Expand Up @@ -71,13 +71,9 @@ func (tu Units) Sprint(value int64) string {
formattedValue := formatter(value)

switch tu.NotationPosition {
case UnitsNotationPositionBefore:
return tu.Notation + formattedValue

case UnitsNotationPositionAfter:
return formattedValue + tu.Notation

default:
default: // UnitsNotationPositionBefore
return tu.Notation + formattedValue
}
}
Expand Down
1 change: 0 additions & 1 deletion table/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func isNumber(x interface{}) bool {
reflect.Float32, reflect.Float64:
return true
}

return false
}

Expand Down

0 comments on commit eaf4190

Please sign in to comment.