👷 gucc: accept char as delim in utils::join instead of string_view

This commit is contained in:
Vladislav Nepogodin 2024-07-13 03:37:41 +04:00
parent e2a39f2a8b
commit 809786d547
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
4 changed files with 5 additions and 5 deletions

View File

@ -35,7 +35,7 @@ auto make_multiline(const std::vector<std::string>& multiline, bool reverse = fa
/// @param lines The lines to join.
/// @param delim The delimiter to join the lines.
/// @return The joined lines as a single string.
auto join(const std::vector<std::string>& lines, std::string_view delim = "\n") noexcept -> std::string;
auto join(const std::vector<std::string>& lines, char delim = '\n') noexcept -> std::string;
/// @brief Make a split view from a string into multiple lines based on a delimiter.
/// @param str The string to split.

View File

@ -35,7 +35,7 @@ auto make_multiline(const std::vector<std::string>& multiline, bool reverse, std
return res;
}
auto join(const std::vector<std::string>& lines, std::string_view delim) noexcept -> std::string {
auto join(const std::vector<std::string>& lines, char delim) noexcept -> std::string {
return lines | std::ranges::views::join_with(delim) | std::ranges::to<std::string>();
}

View File

@ -85,7 +85,7 @@ auto create_new_user(const user::UserInfo& user_info, const std::vector<std::str
// Set user groups
spdlog::info("Setting groups for user {}", user_info.username);
const auto& groups_set_cmd = fmt::format(FMT_COMPILE("usermod -aG {} {}"), utils::join(default_groups, ","), user_info.username);
const auto& groups_set_cmd = fmt::format(FMT_COMPILE("usermod -aG {} {}"), utils::join(default_groups, ','), user_info.username);
if (!utils::arch_chroot_checked(groups_set_cmd, mountpoint)) {
spdlog::error("Failed to set user groups with {}", groups_set_cmd);
return false;

View File

@ -810,7 +810,7 @@ void install_base(const std::string_view& packages) noexcept {
spdlog::error("Failed to install base");
return;
}
const auto& base_pkgs = gucc::utils::join(*pkg_list, " ");
const auto& base_pkgs = gucc::utils::join(*pkg_list, ' ');
spdlog::info("Preparing for pkgs to install: '{}'", base_pkgs);
@ -908,7 +908,7 @@ void install_desktop(const std::string_view& desktop) noexcept {
spdlog::error("Failed to install desktop");
return;
}
const auto& packages = gucc::utils::join(*pkg_list, " ");
const auto& packages = gucc::utils::join(*pkg_list, ' ');
spdlog::info("Preparing for desktop envs to install: '{}'", packages);
utils::install_from_pkglist(packages);