diff options
Diffstat (limited to 'src/buildtool/common/cli.hpp')
-rw-r--r-- | src/buildtool/common/cli.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index cfe2263a..cf348bff 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -19,8 +19,10 @@ #include <cstddef> #include <cstdlib> #include <filesystem> +#include <optional> #include <string> #include <thread> +#include <type_traits> #include <vector> #include "CLI/CLI.hpp" @@ -47,6 +49,7 @@ struct CommonArguments { struct LogArguments { std::vector<std::filesystem::path> log_files{}; LogLevel log_limit{kDefaultLogLevel}; + std::optional<LogLevel> restrict_stderr_log_limit{}; bool plain_log{false}; bool log_append{false}; }; @@ -249,6 +252,14 @@ static inline auto SetupLogArguments( static_cast<int>(kLastLogLevel), static_cast<int>(kDefaultLogLevel))) ->type_name("NUM"); + app->add_option_function<std::underlying_type_t<LogLevel>>( + "--restrict-stderr-log-limit", + [clargs](auto const& limit) { + clargs->restrict_stderr_log_limit = ToLogLevel(limit); + }, + "Restrict logging on console to the minimum of the specified " + "--log-limit and this value") + ->type_name("NUM"); app->add_flag("--plain-log", clargs->plain_log, "Do not use ANSI escape sequences to highlight messages."); |