40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * This Source Code Form is subject to the terms of the Mozilla Public
 | |
|  * License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
|  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 | |
|  */
 | |
| #include <filesystem>
 | |
| 
 | |
| #include <ftxui/component/screen_interactive.hpp>
 | |
| #include <ftxui/dom/elements.hpp>
 | |
| #include <ftxui/component/component.hpp>
 | |
| #include <toml.hpp>
 | |
| 
 | |
| #include "katja/sbo.hpp"
 | |
| #include "katja/database.hpp"
 | |
| 
 | |
| import page;
 | |
| 
 | |
| 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;
 | |
| }
 |