-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add upload status indicator (#10)
* refactor(cmd-utils): move printer to cmd utils * build: remove go clean call as it is insane * feat(progress-indicator): add initial progress indicator * chore(changelog): update changelog
- Loading branch information
1 parent
21ce60a
commit d27c124
Showing
12 changed files
with
156 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package utils | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/jedib0t/go-pretty/v6/progress" | ||
) | ||
|
||
// NewProgressWriter returns a pre-configured progress writer. | ||
func NewProgressWriter(updateFrequency time.Duration) progress.Writer { | ||
writer := progress.NewWriter() | ||
|
||
writer.ShowTime(true) | ||
writer.ShowTracker(false) | ||
writer.ShowValue(false) | ||
|
||
writer.SetAutoStop(true) | ||
writer.SetTrackerPosition(progress.PositionRight) | ||
|
||
writer.SetMessageWidth(50) | ||
writer.SetUpdateFrequency(updateFrequency) | ||
|
||
writer.Style().Colors = progress.StyleColorsDefault | ||
writer.Style().Options.DoneString = "uploaded!" | ||
writer.Style().Options.ErrorString = "failed! " // Have the same length as DoneString | ||
writer.Style().Options.Separator = "\t" | ||
writer.Style().Options.SnipIndicator = "..." | ||
|
||
return writer | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package utils_test | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
"time" | ||
|
||
"github.com/gabor-boros/minutes/internal/cmd/utils" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestNewProgressWriter(t *testing.T) { | ||
progressWriter := utils.NewProgressWriter(time.Millisecond * 100) | ||
require.Equal(t, "*progress.Progress", reflect.TypeOf(progressWriter).String()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.