Add functional argument for setting the width of the progress bar

This commit is contained in:
Christian Rocha 2020-11-18 18:26:30 -05:00 committed by Christian Rocha
parent 47b8d9c6a8
commit 5d6d8cb0fb

View File

@ -60,6 +60,15 @@ func WithoutPercentage() Option {
}
}
// WithWidth sets the initial width of the progress bar. Note that you can also
// set the width via the Width property, which can come in handy if you're
// waiting for a tea.WindowSizeMsg.
func WithWidth(w int) Option {
return func(m *Model) {
m.Width = w
}
}
// Model stores values we'll use when rendering the progress bar.
type Model struct {