mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
👷 update device selection page
This commit is contained in:
parent
b1aa7a8c62
commit
d0bc5f469a
@ -116,7 +116,11 @@ void select_device() noexcept {
|
||||
return menu->Render() | center | size(HEIGHT, GREATER_THAN, 10) | size(WIDTH, GREATER_THAN, 40);
|
||||
});
|
||||
|
||||
auto ok_callback = [&] { config_data["DEVICE"] = devices_list[selected]; };
|
||||
auto ok_callback = [&] {
|
||||
auto src = devices_list[selected];
|
||||
const auto& lines = utils::make_multiline(src, " ");
|
||||
config_data["DEVICE"] = lines[0];
|
||||
};
|
||||
auto controls_container = controls_widget({"OK", "Cancel"}, {ok_callback, screen.ExitLoopClosure()});
|
||||
|
||||
auto controls = Renderer(controls_container, [&] {
|
||||
|
@ -110,8 +110,7 @@ bool prompt_char(const char* prompt, const char* color, char* read) noexcept {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto make_multiline(std::string& str) noexcept -> std::vector<std::string> {
|
||||
static constexpr std::string_view delim{"\n"};
|
||||
auto make_multiline(std::string& str, const std::string_view&& delim) noexcept -> std::vector<std::string> {
|
||||
std::vector<std::string> lines{};
|
||||
|
||||
std::size_t start{};
|
||||
|
@ -12,7 +12,7 @@ void print_banner() noexcept;
|
||||
[[nodiscard]] bool is_connected() noexcept;
|
||||
bool prompt_char(const char* prompt, const char* color = RESET, char* read = nullptr) noexcept;
|
||||
void clear_screen() noexcept;
|
||||
[[nodiscard]] auto make_multiline(std::string& str) noexcept -> std::vector<std::string>;
|
||||
[[nodiscard]] auto make_multiline(std::string& str, const std::string_view&& delim = "\n") noexcept -> std::vector<std::string>;
|
||||
|
||||
auto exec(const std::string_view& command, bool capture_output = true) noexcept -> std::string;
|
||||
[[nodiscard]] bool check_root() noexcept;
|
||||
|
Loading…
Reference in New Issue
Block a user