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 Dot
) )
const (
defaultFPS = 9
)
var ( var (
// Spinner frames // Spinner frames
spinners = map[Spinner][]string{ spinners = map[Spinner][]string{
@ -61,7 +65,7 @@ type Model struct {
func NewModel() Model { func NewModel() Model {
return Model{ return Model{
Type: Line, Type: Line,
FPS: 9, FPS: defaultFPS,
} }
} }

View File

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