aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.config/write.cc
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-07-01 17:07:04 +0100
committerLexi Winter <lexi@le-fay.org>2025-07-01 17:07:04 +0100
commit2e2d1bd3b6c7776b77c33b94f30ead89367a71e6 (patch)
tree54d37ffadf8e677938d9b7a28e4e9b71be1e75c1 /nihil.config/write.cc
parent36427c0966faa7aecd586b397ed9b845f18172f5 (diff)
downloadnihil-2e2d1bd3b6c7776b77c33b94f30ead89367a71e6.tar.gz
nihil-2e2d1bd3b6c7776b77c33b94f30ead89367a71e6.tar.bz2
add nihil.std
Diffstat (limited to 'nihil.config/write.cc')
-rw-r--r--nihil.config/write.cc41
1 files changed, 0 insertions, 41 deletions
diff --git a/nihil.config/write.cc b/nihil.config/write.cc
deleted file mode 100644
index 80125a8..0000000
--- a/nihil.config/write.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This source code is released into the public domain.
- */
-
-module;
-
-#include <coroutine>
-#include <expected>
-#include <filesystem>
-#include <format>
-#include <utility>
-
-module nihil.config;
-
-import nihil.error;
-import nihil.monad;
-import nihil.posix;
-import nihil.ucl;
-
-namespace nihil::config {
-
-auto write_to(std::filesystem::path const &filename)
- -> std::expected<void, error>
-{
- auto uclconfig = ucl::map<ucl::object>();
-
- // Add all the options to the UCL object.
- for (auto const &option : store::get().all()) {
- if (option->is_default())
- continue;
-
- auto uobj = co_await option->ucl();
- uclconfig.insert({option->name(), uobj});
- }
-
- auto ucl_text = std::format("{:c}", uclconfig);
- co_await safe_write_file(filename, ucl_text);
- co_return {};
-}
-
-};