mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-15 11:58:52 +08:00
Minor API change in progress bar
This commit is contained in:
@@ -12,7 +12,7 @@ class ProgressBar {
|
|||||||
std::string _start{"[ "};
|
std::string _start{"[ "};
|
||||||
std::string _fill{"■"};
|
std::string _fill{"■"};
|
||||||
std::string _lead{"■"};
|
std::string _lead{"■"};
|
||||||
std::string _negative_space{"-"};
|
std::string _remainder{"-"};
|
||||||
std::string _end{" ]"};
|
std::string _end{" ]"};
|
||||||
std::mutex _mutex;
|
std::mutex _mutex;
|
||||||
|
|
||||||
@@ -41,8 +41,8 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressBar& negative_space(const std::string& negative_space) {
|
ProgressBar& remainder_with(const std::string& remainder) {
|
||||||
_negative_space = negative_space;
|
_remainder = remainder;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
for (size_t i = 0; i < _bar_width; ++i) {
|
for (size_t i = 0; i < _bar_width; ++i) {
|
||||||
if (i < pos) std::cout << _fill;
|
if (i < pos) std::cout << _fill;
|
||||||
else if (i == pos) std::cout << _lead;
|
else if (i == pos) std::cout << _lead;
|
||||||
else std::cout << _negative_space;
|
else std::cout << _remainder;
|
||||||
}
|
}
|
||||||
std::cout << _end << " " << static_cast<int>(value) << "%";
|
std::cout << _end << " " << static_cast<int>(value) << "%";
|
||||||
std::cout << " " << _name << "\r";
|
std::cout << " " << _name << "\r";
|
||||||
|
|||||||
Reference in New Issue
Block a user