diff options
author | Finn Behrens <me@kloenk.dev> | 2024-06-01 16:06:26 +0200 |
---|---|---|
committer | Finn Behrens <me@kloenk.dev> | 2024-06-22 14:20:27 +0200 |
commit | da4e46dd1fc04067b5ba4bc16dd68134fa7efad2 (patch) | |
tree | de928e67208328cac91b1afb8ce368918f0b8266 /src/libmain/progress-bar.hh | |
parent | 21865ccce0a5bf6edcb98a09b57b3f076ee9ba9f (diff) |
libmain: add progress bar with multiple status lines
Add the log-formats `multiline` and `multiline-with-logs` which offer
multiple current active building status lines.
Change-Id: Idd8afe62f8591b5d8b70e258c5cefa09be4cab03
Diffstat (limited to 'src/libmain/progress-bar.hh')
-rw-r--r-- | src/libmain/progress-bar.hh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libmain/progress-bar.hh b/src/libmain/progress-bar.hh index 76e2ed4ff..176e941e8 100644 --- a/src/libmain/progress-bar.hh +++ b/src/libmain/progress-bar.hh @@ -47,6 +47,8 @@ struct ProgressBar : public Logger std::map<ActivityType, ActivitiesByType> activitiesByType; + int lastLines = 0; + uint64_t filesLinked = 0, bytesLinked = 0; uint64_t corruptedPaths = 0, untrustedPaths = 0; @@ -63,6 +65,7 @@ struct ProgressBar : public Logger std::condition_variable quitCV, updateCV; bool printBuildLogs = false; + bool printMultiline = false; bool isTTY; ProgressBar(bool isTTY) @@ -75,7 +78,7 @@ struct ProgressBar : public Logger while (state->active) { if (!state->haveUpdate) state.wait_for(updateCV, nextWakeup); - nextWakeup = draw(*state); + nextWakeup = draw(*state, {}); state.wait_for(quitCV, std::chrono::milliseconds(50)); } }); @@ -114,7 +117,7 @@ struct ProgressBar : public Logger void update(State & state); - std::chrono::milliseconds draw(State & state); + std::chrono::milliseconds draw(State & state, const std::optional<std::string_view> & s); std::string getStatus(State & state); @@ -123,6 +126,8 @@ struct ProgressBar : public Logger std::optional<char> ask(std::string_view msg) override; void setPrintBuildLogs(bool printBuildLogs) override; + + void setPrintMultiline(bool printMultiline) override; }; Logger * makeProgressBar(); |