Initial commit
This commit is contained in:
32
cli/main.cpp
Normal file
32
cli/main.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#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;
|
||||
}
|
Reference in New Issue
Block a user