👷 add devices ui

This commit is contained in:
Vladislav Nepogodin 2021-12-02 02:23:41 +04:00
parent 279b6539b7
commit 297c353e40
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
2 changed files with 23 additions and 7 deletions

View File

@ -1,5 +1,6 @@
#include "tui.hpp"
#include "definitions.hpp"
#include "utils.hpp"
#include <ftxui/component/captured_mouse.hpp>
#include <ftxui/component/component.hpp>
@ -31,6 +32,28 @@ ftxui::Element centered_widget(ftxui::Component& container, const std::string_vi
});
}
// Simple code to show devices / partitions.
void show_devices() {
auto screen = ScreenInteractive::Fullscreen();
const auto& lsblk = utils::exec("lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT | grep \"disk\\|part\\|lvm\\|crypt\\|NAME\\|MODEL\\|TYPE\\|FSTYPE\\|SIZE\\|MOUNTPOINT\"");
/* clang-format off */
auto button_option = ButtonOption();
button_option.border = false;
auto button_back = Button("Back", screen.ExitLoopClosure(), &button_option);
/* clang-format on */
auto container = Container::Horizontal({
button_back,
});
auto renderer = Renderer(container, [&] {
return tui::centered_widget(container, "New CLI Installer", text(lsblk.data()) | size(HEIGHT, GREATER_THAN, 5));
});
screen.Loop(renderer);
}
void init() noexcept {
auto screen = ScreenInteractive::Fullscreen();

View File

@ -99,13 +99,6 @@ bool prompt_char(const char* prompt, const char* color, char* read) noexcept {
return false;
}
// Simple code to show devices / partitions.
void show_devices() {
[[maybe_unused]] const auto& lsblk = utils::exec("lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT | grep \"disk\\|part\\|lvm\\|crypt\\|NAME\\|MODEL\\|TYPE\\|FSTYPE\\|SIZE\\|MOUNTPOINT\"");
// DIALOG " $_DevShowOpt " --textbox /tmp/.devlist 0 0
}
void id_system() noexcept {
auto* config_instance = Config::instance();
auto& config_data = config_instance->data();