mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-02-02 22:07:13 +08:00
👷 add function to dump settings
This commit is contained in:
parent
1f0cfb9b10
commit
dcad598b02
@ -271,6 +271,18 @@ void dump_to_log(const std::string& data) noexcept {
|
||||
spdlog::info("[DUMP_TO_LOG] :=\n{}", data);
|
||||
}
|
||||
|
||||
void dump_settings_to_log() noexcept {
|
||||
auto* config_instance = Config::instance();
|
||||
auto& config_data = config_instance->data();
|
||||
|
||||
std::string out{};
|
||||
for(const auto& [key, value] : config_data) {
|
||||
const auto& value_formatted = std::visit([](auto&& arg) -> std::string { return fmt::format("{}", arg); }, value);
|
||||
out += fmt::format("Option: [{}], Value: [{}]\n", key, value_formatted);
|
||||
}
|
||||
spdlog::info("Settings:\n{}", out);
|
||||
}
|
||||
|
||||
bool prompt_char(const char* prompt, const char* color, char* read) noexcept {
|
||||
fmt::print("{}{}{}\n", color, prompt, RESET);
|
||||
|
||||
|
@ -68,6 +68,7 @@ auto exec(const std::string_view& command, const bool& interactive = false) noex
|
||||
[[nodiscard]] auto read_whole_file(const std::string_view& filepath) noexcept -> std::string;
|
||||
bool write_to_file(const std::string_view& data, const std::string_view& filepath) noexcept;
|
||||
void dump_to_log(const std::string& data) noexcept;
|
||||
void dump_settings_to_log() noexcept;
|
||||
[[nodiscard]] bool check_root() noexcept;
|
||||
void id_system() noexcept;
|
||||
[[nodiscard]] bool handle_connection() noexcept;
|
||||
|
Loading…
Reference in New Issue
Block a user