Use consts for default values

This commit is contained in:
Christian Muehlhaeuser 2020-05-25 14:12:42 +02:00
parent cd4e02b1a8
commit bb85a886fd
No known key found for this signature in database
GPG Key ID: 3CF9FA45CA1EBB7E
2 changed files with 10 additions and 2 deletions

View File

@ -16,6 +16,10 @@ const (
Dot
)
const (
defaultFPS = 9
)
var (
// Spinner frames
spinners = map[Spinner][]string{
@ -61,7 +65,7 @@ type Model struct {
func NewModel() Model {
return Model{
Type: Line,
FPS: 9,
FPS: defaultFPS,
}
}

View File

@ -8,6 +8,10 @@ import (
"github.com/muesli/termenv"
)
const (
defaultBlinkSpeed = time.Millisecond * 600
)
var (
// color is a helper for returning colors
color func(s string) termenv.Color = termenv.ColorProfile().Color
@ -160,7 +164,7 @@ type BlinkMsg struct{}
func NewModel() Model {
return Model{
Prompt: "> ",
BlinkSpeed: time.Millisecond * 600,
BlinkSpeed: defaultBlinkSpeed,
Placeholder: "",
TextColor: "",
PlaceholderColor: "240",