katja/cli/main.cpp
2025-04-19 14:48:02 +02:00

33 lines
1.1 KiB
C++

#include <filesystem>
#include <ftxui/component/screen_interactive.hpp>
#include <ftxui/dom/elements.hpp>
#include <toml.hpp>
#include "katja/sbo.hpp"
#include "katja/database.hpp"
#include "component.hpp"
int main(int argc, const char **argv)
{
auto configuration = toml::parse("katja.toml");
katja::package_database installed_database = katja::read_installed_database();
for (const auto& [repository_name, repository_value] : configuration.as_table())
{
std::filesystem::path slackbuild_repository{ repository_value.at("path").as_string() };
auto repository = std::make_shared<katja::sbo_repository>(slackbuild_repository);
auto screen = ftxui::ScreenInteractive::Fullscreen();
auto container = Screen(std::vector<std::pair<std::string, katja::Page>>{
{ "Home", ftxui::Make<katja::WelcomePage>() },
{ "Updates", ftxui::Make<katja::UpdatesPage>(repository, std::move(installed_database)) },
{ "Search", ftxui::Make<katja::SearchPage>(repository, "x86-64") }
}, screen.ExitLoopClosure());
screen.Loop(container);
}
return EXIT_SUCCESS;
}