-
-
Notifications
You must be signed in to change notification settings - Fork 131
Formatting
Jeff Felchner edited this page Sep 15, 2017
·
12 revisions
The format of the progress bar is extremely easy to customize. When you create the progress bar and pass the :format
option, that string will be used to determine what the bar looks like.
Note: Most of this information is also exposed via to_h
which is a bit more script-friendly if you need only a single piece or two of information.
All values have an absolute length with the exception of the bar flags which will occupy any leftover space.
You can use as many bar flags as you'd like, but if you do weird things, weird things will happen; so be wary.
The flags you can use in the format string are as follows:
Flag | Description |
---|---|
%t |
Title |
%% |
A literal percent sign %
|
Flag | Description |
---|---|
%a |
Elapsed (absolute) time |
%e |
Estimated time (will fall back to ETA: ??:??:?? when it exceeds 99:00:00 ) |
%E |
Estimated time (will fall back to ETA: > 4 Days when it exceeds 99:00:00 ) |
%f |
Force estimated time to be displayed even if it exceeds 99:00:00
|
Flag | Description |
---|---|
%p |
Percentage complete represented as a whole number (eg: 82 ) |
%P |
Percentage complete represented as a decimal number (eg: 82.33 ) |
%j |
Percentage complete right-justified to 3 places (eg: 82 ) |
%J |
Percentage complete right-justified to 6 places (eg: 82.33 ) |
Flag | Description |
---|---|
%c |
Number of items currently completed |
%C |
Total number of items to be completed |
%u |
Total number of items to be completed (falls back to ?? if total is unknown) |
Flag | Description |
---|---|
%B |
The full progress bar including 'incomplete' space (eg: ========== ) |
%b |
Progress bar only (eg: ========== ) |
%w |
Bar With Integrated Percentage (eg: ==== 75 ==== ) |
%i |
Display the incomplete space of the bar (this string will only contain whitespace eg: ) |
Flag | Description |
---|---|
%r |
Rate of Progress as a whole number (eg: 13 ) |
%R |
Rate of Progress as a decimal number (eg: 13.67 ) |