+std::string
+PackageManagerFancy::GetTextProgressStr(float Percent, int OutputSize)
+{
+ std::string output;
+ if (unlikely(OutputSize < 3))
+ return output;
+
+ int const BarSize = OutputSize - 2; // bar without the leading "[" and trailing "]"
+ int const BarDone = std::max(0, std::min(BarSize, static_cast<int>(std::floor(Percent * BarSize))));
+ output.append("[");
+ std::fill_n(std::fill_n(std::back_inserter(output), BarDone, '#'), BarSize - BarDone, '.');
+ output.append("]");
+ return output;
+}
+