From 5d6d8cb0fb58561d41db968251ea23ce3805c2aa Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Wed, 18 Nov 2020 18:26:30 -0500 Subject: [PATCH] Add functional argument for setting the width of the progress bar --- progress/progress.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/progress/progress.go b/progress/progress.go index 9b3c3fd..aa4c313 100644 --- a/progress/progress.go +++ b/progress/progress.go @@ -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 {