Add a MaxProgress option (default: 100).

The MaxProgress option allows you to set the maximum number of ticks
that are within a progress bar. Each call to tick() increments the tick
count. The progress bar percentage is the number of ticks divided by the
MaxProgress option.

The default MaxProgress is 100, so each tick would be 1%.  If
MaxProgress is set to 500, for example, then each tick would be 0.2%.
This commit is contained in:
Kevin M. Godby
2020-04-30 21:37:06 -05:00
parent df4a97b068
commit 371bcb2c3b
6 changed files with 71 additions and 23 deletions

View File

@@ -89,7 +89,8 @@ enum class ProgressBarOption {
spinner_show,
spinner_states,
font_styles,
hide_bar_when_complete
hide_bar_when_complete,
max_progress
};
template <typename T, ProgressBarOption Id> struct Setting {
@@ -204,5 +205,6 @@ using HideBarWhenComplete =
details::BooleanSetting<details::ProgressBarOption::hide_bar_when_complete>;
using FontStyles =
details::Setting<std::vector<FontStyle>, details::ProgressBarOption::font_styles>;
using MaxProgress = details::IntegerSetting<details::ProgressBarOption::max_progress>;
} // namespace option
} // namespace indicators