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

ETA "Infinity"s #21

Closed
AxelTerizaki opened this issue Jun 14, 2018 · 5 comments
Closed

ETA "Infinity"s #21

AxelTerizaki opened this issue Jun 14, 2018 · 5 comments

Comments

@AxelTerizaki
Copy link

Hello :)

I have one minor problem with cli-progress so far.

I'm using it to display a download progress bar, but it sometimes is for really big files, and with some slow connections, sometimes "Infinity" is displayed instead of the time in the ETA variable.

Would it be possible to replace it by something else, like a -, ~, or the infinite symbol perhaps, when this happens? Having "Infinitys" sometimes bugs the progress bar into making new lines because it suddenly grows out of the number of characters allowed per line.

Thanks in advance :)

@AndiDittrich
Copy link
Member

hi @AxelTerizaki ,

thanks for your report!
could you reproduce the issue with a simple testcase ? this would be great :)

btw, version 2.x of cli-progress has an option to disable line wrapping (no new lines, content is stripped to max line length)

best regards, Andi

@AxelTerizaki
Copy link
Author

Hmmm, going to be difficult just like that but I'll think about it.

I suppose I could simulate a very slow transfer :) Can't promise to do it before next week though! It's not a big big issue so...

@AxelTerizaki
Copy link
Author

AxelTerizaki commented Jun 16, 2018

Here's some code I just used :

const _cliProgress = require('cli-progress');
import {promisify} from 'util';
const sleep = promisify(setTimeout);

async function updateBar() {
	bar1.update(1);
	await sleep(3600);	
}

const bar1 = new _cliProgress.Bar({}, _cliProgress.Presets.shades_classic);

bar1.start(99999999999999999999999999999999999999999999999999999999, 0);


// update the current value in your application..
Promise.resolve().then(function resolver() {
	return updateBar()
		.then(resolver);
});

It updates the bar after one hour, and since the bar's pretty big, it has a hard time calculating an ETA. I end up with that after 30 seconds or so :

 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0% | ETA: Infinitys | 1/1e+56

Hope it'll help :)

@AndiDittrich
Copy link
Member

thanks!

i will take a look on it soon.

@AndiDittrich
Copy link
Member

should be addressed in ac29f07

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

No branches or pull requests

2 participants