mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 22:42:31 +08:00
👷 add devices ui
This commit is contained in:
parent
279b6539b7
commit
297c353e40
23
src/tui.cpp
23
src/tui.cpp
@ -1,5 +1,6 @@
|
|||||||
#include "tui.hpp"
|
#include "tui.hpp"
|
||||||
#include "definitions.hpp"
|
#include "definitions.hpp"
|
||||||
|
#include "utils.hpp"
|
||||||
|
|
||||||
#include <ftxui/component/captured_mouse.hpp>
|
#include <ftxui/component/captured_mouse.hpp>
|
||||||
#include <ftxui/component/component.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 {
|
void init() noexcept {
|
||||||
auto screen = ScreenInteractive::Fullscreen();
|
auto screen = ScreenInteractive::Fullscreen();
|
||||||
|
|
||||||
|
@ -99,13 +99,6 @@ bool prompt_char(const char* prompt, const char* color, char* read) noexcept {
|
|||||||
return false;
|
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 {
|
void id_system() noexcept {
|
||||||
auto* config_instance = Config::instance();
|
auto* config_instance = Config::instance();
|
||||||
auto& config_data = config_instance->data();
|
auto& config_data = config_instance->data();
|
||||||
|
Loading…
Reference in New Issue
Block a user