Hello! This is mainly a curiousity question, I may apply it to something in the near future though just as an added twist... :D
So essentially I want to figure out how a progress indicator is created in the shell.
For example with wget or something you may see a progress bar like this:
[======================> ] 96%
or something like that.
I know how to acheive the bar itself by using escape characters such as \b (backspace, overwrite characters), \r (carriage return, go to beginning of line and update characters) and such.
What I want to figure out is how to make it not some fake thing, how is it accurate like that?
Recently I finished writing a libarchive binding to D (that was a pain xD) and am working on OO D API/wrapper around the C bindings. Soon I'm going to create a mini archiver/compressor tool just as an example of using my binding, I think it would be cool to make it look a bit nicer by using a progress bar/indicator in the shell. How would I create a semi-accurate progress indicator/bar with compressing files?
Hopefully that example makes sense. Thanks for any help, ideas, or suggestions!
Thanks.