mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 22:42:31 +08:00
🧹 use fmt_compile macro
This commit is contained in:
parent
18d3f9edf2
commit
577c2920b9
@ -178,9 +178,9 @@ std::string zfs_list_devs() noexcept {
|
||||
const auto& devices = utils::make_multiline("zpool status -PL 2>/dev/null | awk '{print $1}' | grep \"^/\"");
|
||||
for (const auto& device : devices) {
|
||||
// add the device
|
||||
list_of_devices += fmt::format("{}\n", device);
|
||||
list_of_devices += fmt::format(FMT_COMPILE("{}\n"), device);
|
||||
// now let's add any other forms of those devices
|
||||
list_of_devices += utils::exec(fmt::format("find -L /dev/ -xtype l -samefile {} 2>/dev/null", device));
|
||||
list_of_devices += utils::exec(fmt::format(FMT_COMPILE("find -L /dev/ -xtype l -samefile {} 2>/dev/null"), device));
|
||||
}
|
||||
return list_of_devices;
|
||||
}
|
||||
|
@ -42,15 +42,15 @@ bool Initcpio::write() const noexcept {
|
||||
if (line.starts_with("MODULES")) {
|
||||
auto&& formatted_modules = modules | ranges::views::join(' ')
|
||||
| ranges::to<std::string>();
|
||||
return fmt::format("MODULES=({})", std::move(formatted_modules));
|
||||
return fmt::format(FMT_COMPILE("MODULES=({})"), std::move(formatted_modules));
|
||||
} else if (line.starts_with("FILES")) {
|
||||
auto&& formatted_files = files | ranges::views::join(' ')
|
||||
| ranges::to<std::string>();
|
||||
return fmt::format("FILES=({})", std::move(formatted_files));
|
||||
return fmt::format(FMT_COMPILE("FILES=({})"), std::move(formatted_files));
|
||||
} else if (line.starts_with("HOOKS")) {
|
||||
auto&& formatted_hooks = hooks | ranges::views::join(' ')
|
||||
| ranges::to<std::string>();
|
||||
return fmt::format("HOOKS=({})", std::move(formatted_hooks));
|
||||
return fmt::format(FMT_COMPILE("HOOKS=({})"), std::move(formatted_hooks));
|
||||
}
|
||||
/* clang-format on */
|
||||
return std::string{line.data(), line.size()};
|
||||
|
@ -272,7 +272,7 @@ void menu_simple() noexcept {
|
||||
// so that output will be synchronized.
|
||||
auto logger = spdlog::get("cachyos_logger");
|
||||
logger->flush();
|
||||
utils::exec(fmt::format("{} &>>/tmp/cachyos-install.log", post_install), true);
|
||||
utils::exec(fmt::format(FMT_COMPILE("{} &>>/tmp/cachyos-install.log"), post_install), true);
|
||||
}
|
||||
|
||||
tui::exit_done();
|
||||
@ -284,10 +284,10 @@ void menu_simple() noexcept {
|
||||
"│{4: ^{5}}│\n"
|
||||
"└{0:─^{5}}┘\n",
|
||||
"",
|
||||
fmt::format("Mountpoint: {}", mountpoint),
|
||||
fmt::format("Your device: {}", device_info),
|
||||
fmt::format("Filesystem: {}", fs_name),
|
||||
fmt::format("Filesystem opts: {}", mount_opts_info), 80);
|
||||
fmt::format(FMT_COMPILE("Mountpoint: {}"), mountpoint),
|
||||
fmt::format(FMT_COMPILE("Your device: {}"), device_info),
|
||||
fmt::format(FMT_COMPILE("Filesystem: {}"), fs_name),
|
||||
fmt::format(FMT_COMPILE("Filesystem opts: {}"), mount_opts_info), 80);
|
||||
|
||||
fmt::print("┌{0:─^{5}}┐\n"
|
||||
"│{1: ^{5}}│\n"
|
||||
@ -296,10 +296,10 @@ void menu_simple() noexcept {
|
||||
"│{4: ^{5}}│\n"
|
||||
"└{0:─^{5}}┘\n",
|
||||
"",
|
||||
fmt::format("Kernel: {}", kernel),
|
||||
fmt::format("Desktop: {}", desktop),
|
||||
fmt::format("Drivers type: {}", drivers_type),
|
||||
fmt::format("Bootloader: {}", bootloader), 80);
|
||||
fmt::format(FMT_COMPILE("Kernel: {}"), kernel),
|
||||
fmt::format(FMT_COMPILE("Desktop: {}"), desktop),
|
||||
fmt::format(FMT_COMPILE("Drivers type: {}"), drivers_type),
|
||||
fmt::format(FMT_COMPILE("Bootloader: {}"), bootloader), 80);
|
||||
}
|
||||
|
||||
} // namespace tui
|
||||
|
12
src/tui.cpp
12
src/tui.cpp
@ -1692,12 +1692,12 @@ void zfs_auto() noexcept {
|
||||
const auto& zfs_zpool_name = std::get<std::string>(config_data["ZFS_ZPOOL_NAME"]);
|
||||
|
||||
// next create the datasets including their parents
|
||||
utils::zfs_create_dataset(fmt::format("{}/ROOT", zfs_zpool_name), "none");
|
||||
utils::zfs_create_dataset(fmt::format("{}/ROOT/cos", zfs_zpool_name), "none");
|
||||
utils::zfs_create_dataset(fmt::format("{}/ROOT/cos/root", zfs_zpool_name), "/");
|
||||
utils::zfs_create_dataset(fmt::format("{}/ROOT/cos/home", zfs_zpool_name), "/home");
|
||||
utils::zfs_create_dataset(fmt::format("{}/ROOT/cos/varcache", zfs_zpool_name), "/var/cache");
|
||||
utils::zfs_create_dataset(fmt::format("{}/ROOT/cos/varlog", zfs_zpool_name), "/var/log");
|
||||
utils::zfs_create_dataset(fmt::format(FMT_COMPILE("{}/ROOT"), zfs_zpool_name), "none");
|
||||
utils::zfs_create_dataset(fmt::format(FMT_COMPILE("{}/ROOT/cos"), zfs_zpool_name), "none");
|
||||
utils::zfs_create_dataset(fmt::format(FMT_COMPILE("{}/ROOT/cos/root"), zfs_zpool_name), "/");
|
||||
utils::zfs_create_dataset(fmt::format(FMT_COMPILE("{}/ROOT/cos/home"), zfs_zpool_name), "/home");
|
||||
utils::zfs_create_dataset(fmt::format(FMT_COMPILE("{}/ROOT/cos/varcache"), zfs_zpool_name), "/var/cache");
|
||||
utils::zfs_create_dataset(fmt::format(FMT_COMPILE("{}/ROOT/cos/varlog"), zfs_zpool_name), "/var/log");
|
||||
|
||||
#ifdef NDEVENV
|
||||
// set the rootfs
|
||||
|
@ -110,7 +110,7 @@ bool check_root() noexcept {
|
||||
|
||||
void clear_screen() noexcept {
|
||||
static constexpr auto CLEAR_SCREEN_ANSI = "\033[1;1H\033[2J";
|
||||
output_inter("{}", CLEAR_SCREEN_ANSI);
|
||||
output_inter(FMT_COMPILE("{}"), CLEAR_SCREEN_ANSI);
|
||||
}
|
||||
|
||||
void arch_chroot(const std::string_view& command, bool follow) noexcept {
|
||||
@ -787,7 +787,7 @@ void install_base(const std::string_view& packages) noexcept {
|
||||
const auto& pkg_list = utils::get_pkglist_base(packages);
|
||||
const auto& base_pkgs = utils::make_multiline(pkg_list, false, " ");
|
||||
|
||||
spdlog::info(fmt::format("Preparing for pkgs to install: \"{}\"", base_pkgs));
|
||||
spdlog::info(fmt::format(FMT_COMPILE("Preparing for pkgs to install: \"{}\""), base_pkgs));
|
||||
|
||||
#ifdef NDEVENV
|
||||
// Prep variables
|
||||
@ -882,7 +882,7 @@ void install_desktop(const std::string_view& desktop) noexcept {
|
||||
const auto& pkg_list = utils::get_pkglist_desktop(desktop);
|
||||
const std::string& packages = utils::make_multiline(pkg_list, false, " ");
|
||||
|
||||
spdlog::info(fmt::format("Preparing for desktop envs to install: \"{}\"", packages));
|
||||
spdlog::info(fmt::format(FMT_COMPILE("Preparing for desktop envs to install: \"{}\""), packages));
|
||||
utils::install_from_pkglist(packages);
|
||||
|
||||
auto* config_instance = Config::instance();
|
||||
|
Loading…
Reference in New Issue
Block a user