From c9a3ebd623bf2f968f7fbdf5bb2d7dda480b9f1c Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 18 Jan 2026 18:44:22 +0100 Subject: Parse command line with boost program_options --- cli/component.cpp | 89 ------------------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 cli/component.cpp (limited to 'cli/component.cpp') diff --git a/cli/component.cpp b/cli/component.cpp deleted file mode 100644 index 6735077..0000000 --- a/cli/component.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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/. - */ -module; - -#include -#include - -#include -#include -#include - -import katja.repository; - -export module katja.component; - -export namespace katja -{ - class PackageListBase : public ftxui::ComponentBase - { - std::string title; - const std::vector packages; - std::optional selected; - - public: - PackageListBase(const std::string& title, const std::vector& packages = {}) - : title(title), packages(packages) - { - } - - ftxui::Element OnRender() override - { - std::vector lines; - - for (const auto& package_identifier : this->packages) - { - auto line = ftxui::text(package_identifier.to_string()) | color(ftxui::Color::SkyBlue2); - lines.push_back(line); - } - if (this->selected.has_value() && this->selected.value() < lines.size()) - { - lines[this->selected.value()] |= ftxui::focus; - } - std::stringstream summary; - - summary << title << '(' << packages.size() << ')'; - - return ftxui::window(ftxui::text(summary.str()), ftxui::vbox(lines) | ftxui::yframe); - } - - bool OnEvent(ftxui::Event event) override - { - if (event == ftxui::Event::ArrowDown) - { - if (!this->selected.has_value() && !this->packages.empty()) - { - this->selected = std::make_optional(0); - } - else if (this->selected.has_value() && this->selected.value() + 1 < this->packages.size()) - { - this->selected = std::make_optional(this->selected.value() + 1); - } - return true; - } - else if (event == ftxui::Event::ArrowUp) - { - if (!this->selected.has_value() && !this->packages.empty()) - { - this->selected = std::make_optional(0); - } - else if (this->selected.has_value() - && this->selected.value() < this->packages.size() - && this->selected.value() > 0) - { - this->selected = std::make_optional(this->selected.value() - 1); - } - return true; - } - return false; - } - }; - - ftxui::Component PackageList(const std::string& title, const std::vector& packages = {}) - { - return ftxui::Make(title, packages); - } -} -- cgit v1.2.3