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

Do you support indeterminate progress bar? #57

Closed
mhewedy opened this issue Apr 25, 2020 · 4 comments
Closed

Do you support indeterminate progress bar? #57

mhewedy opened this issue Apr 25, 2020 · 4 comments

Comments

@mhewedy
Copy link

mhewedy commented Apr 25, 2020

I have a case where I want to show a progress but I have no knowledge when the task will finish.

@schollz
Copy link
Owner

schollz commented Apr 25, 2020

Yes, it is supported now. You can do

bar = progressbar.NewOptions(-1,
	progressbar.OptionShowIts(),
)

A count of -1 puts it indeterminate mode.

@mhewedy mhewedy closed this as completed Apr 27, 2020
@mhewedy
Copy link
Author

mhewedy commented Apr 27, 2020

95% |                                     █  | (78/-, 88 it/s)

Can we get rid of the percentage on the left?

@mhewedy mhewedy reopened this Apr 27, 2020
@schollz
Copy link
Owner

schollz commented Apr 30, 2020

I just changed this behavior for 3.2.0. Since an indeterminate bar is just a spinner, I made it a spinner.

bar := NewOptions(-1,
	OptionSetWidth(10),
	OptionSetDescription("indeterminate spinner"),
	OptionShowIts(),
	OptionShowCount(),
	OptionSpinnerType(1),
)
for i := 0; i < 10; i++ {
	time.Sleep(100 * time.Millisecond)
	bar.Add(1)
}

@mhewedy
Copy link
Author

mhewedy commented Apr 30, 2020

I just changed this behavior for 3.2.0. Since an indeterminate bar is just a spinner, I made it a spinner.

bar := NewOptions(-1,
	OptionSetWidth(10),
	OptionSetDescription("indeterminate spinner"),
	OptionShowIts(),
	OptionShowCount(),
	OptionSpinnerType(1),
)
for i := 0; i < 10; i++ {
	time.Sleep(100 * time.Millisecond)
	bar.Add(1)
}

I Love it ... specially spinner types

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

No branches or pull requests

2 participants