Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Add ability to use custom style for bytes showing #139

Closed

Conversation

amanenk
Copy link

@amanenk amanenk commented Sep 30, 2022

I have added ability to customize way of bytes show by adding an option.

func ExampleOptionUseCustomBytesShowWithMax() {
	bar := NewOptions(100,
		OptionSetWidth(10),
		OptionShowIts(),
		OptionShowCount(),
		OptionSetElapsedTime(false), OptionUseCustomBytesShow(func(f float64, i int64) string {
			return fmt.Sprintf("%.0f of %d items", f, i)
		}))
	bar.Reset()
	time.Sleep(1 * time.Second)
	bar.Add(5)

	// Output:
	// -  (5 of 100 items, 5 it/s)
}

closes #138

@schollz
Copy link
Owner

schollz commented Oct 22, 2022

Sorry for the delay in response. It looks like a test is failing - could you fix the test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an ability to avoid "/-" if no max value is set.
2 participants