Comments (11)
Yeah, a fractional percentage is a great idea. I'll happily take a PR for this
from progressbar.
Started it ce5fc5d
from progressbar.
Well, if you don't mind my whole 3 days' familiarity with golang ;) i can surely patch
Line 317 in 77e36af
forceRender
flag that will invalidate the bar every time an Add
is performed.
Besides, there's also a related bug: config.maxBytes
isn't used anywhere, but checked for during invalidation:
Line 325 in 77e36af
from progressbar.
Oops, you started the PR while i've been typing my comment on how to do it :). After looking into the code, my previous comment is still relevant, updating percent variable type to float won't help in my particular case.
from progressbar.
Okay cool! If you'd like, I would love if you submit a patch as a PR. The decimals can come later (it will require fixing a lot of tests). Don't worry that you only have 3 days familiarity with Go :) I will be available to assist or answer any questions or anything else! Please don't hesitate to ask. Welcome to Go!
from progressbar.
Cool, it's quarantine anyway and i've got nothing better to do :). But i mean are you okay with what i'm proposing: forceRender
flag exposed through an Option
and added to quoted lines 317 or 325?
from progressbar.
@ikonkere That seems fine to me! If you want to, you can also make a test that shows your problem so that I don't accidentally introduce something in the future that causes it again :) No worries if you don't want to.
from progressbar.
Ok, made a PR: #55. I actually wanted to totally rework how rendering is done (you can see here if you want https://github.com/ikonkere/progressbar/tree/invalidate), but making async CLI UI components in Go turned out way harder than i expected ;).
from progressbar.
Your PR looks good. I'll check it out soon for merge (I think its just fine!).
As for async rendering, I was actually trying to avoid it here. There are reasons you might want to do it, so please fork away (I would add a ticker to yours if I were you to avoid high CPU)! But for this project I'm trying to keep a progressbar that is essentially a state machine, where it only updates once it has some update.
from progressbar.
Yeah, asynch rendering kinda contradicts "simple", so i stashed the change within my fork for now, to think it over, but it's a good, although harsh way to get into a programming language :).
from progressbar.
Hey @schollz, it was mentioned that fractional percentages may be a solution:
It is possible to introduce fractional percentage...
Has this been implemented? If yes, how exactly do I utilize this? I am confused because as of now Add()
does not accept floats of any kind.
from progressbar.
Related Issues (20)
- Keep elapsed time when finished HOT 1
- Consume int for new progress bar HOT 1
- [Bug] Console output after progress bar doesn't start with new line HOT 4
- Latest release won't build on go <1.18 HOT 1
- Add an ability to avoid "/-" if no max value is set.
- How to display all steps in spinner
- ChangeMax not working
- Progressbar pauses execution in Windows when clicked HOT 1
- docker logs -f does not show progress bar HOT 1
- Doesn't stream content to the file. HOT 2
- Hide the progress bar after downloading
- Progress bar displays incorrectly if the operation is too quick. HOT 2
- go version broken by `github.com/rivo/uniseg v0.4.3 // indirect ` HOT 1
- Command line docker build support?
- Update README Installation Instructions from Get to Install HOT 1
- Issue with go-mod-tidy pre-commit after using the progressbar
- Bad size value with (fs.FileInfo).Size() on parameter HOT 1
- I have a problem with ansi.NewStdout() HOT 1
- Progress bar moves down during download process HOT 1
- spinner does not update according to its phases if there are too few state modification HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from progressbar.