mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-02-02 22:07:13 +08:00
♻ cleanup
This commit is contained in:
parent
dc5f12e92d
commit
4d8f1a08e0
@ -39,8 +39,8 @@ FetchContent_Declare(nlohmann_json
|
||||
FetchContent_MakeAvailable(nlohmann_json)
|
||||
|
||||
FetchContent_Declare(cpr
|
||||
GIT_REPOSITORY "https://github.com/libcpr/cpr.git"
|
||||
GIT_TAG "bcb7729dd6d930820fb858f63c97ad559241b789"
|
||||
GIT_REPOSITORY "https://github.com/vnepogodin/cpr.git"
|
||||
GIT_TAG "824358455f61629ca43422adce0243bb05e99bf8"
|
||||
)
|
||||
FetchContent_MakeAvailable(cpr)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
function(set_project_warnings project_name)
|
||||
option(WARNINGS_AS_ERRORS "Treat compiler warnings as error" OFF)
|
||||
option(WARNINGS_AS_ERRORS "Treat compiler warnings as error" ON)
|
||||
|
||||
set(MSVC_WARNINGS
|
||||
/W4 # Base
|
||||
|
@ -5,7 +5,7 @@ project('cachyos-installer', 'cpp',
|
||||
default_options: ['cpp_std=c++20',
|
||||
'buildtype=debugoptimized',
|
||||
'warning_level=3',
|
||||
'werror=false',
|
||||
'werror=true',
|
||||
'b_ndebug=if-release'])
|
||||
|
||||
is_debug_build = get_option('buildtype').startswith('debug')
|
||||
|
@ -17,14 +17,14 @@
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace utils {
|
||||
static constexpr int32_t CONNECTION_TIMEOUT = 15;
|
||||
static constexpr std::int32_t CONNECTION_TIMEOUT = 15;
|
||||
|
||||
bool is_connected() noexcept {
|
||||
/* clang-format off */
|
||||
auto r = cpr::Get(cpr::Url{"https://www.google.com"},
|
||||
cpr::Timeout{1000});
|
||||
/* clang-format on */
|
||||
return cpr::status::is_success(r.status_code);
|
||||
return cpr::status::is_success(static_cast<std::int32_t>(r.status_code));
|
||||
}
|
||||
|
||||
bool check_root() noexcept {
|
||||
@ -38,7 +38,7 @@ void clear_screen() noexcept {
|
||||
|
||||
std::string exec(const std::string_view& command, bool capture_output) noexcept {
|
||||
if (!capture_output) {
|
||||
int32_t status{};
|
||||
std::int32_t status{};
|
||||
auto pid = fork();
|
||||
if (pid == 0) {
|
||||
/* clang-format off */
|
||||
@ -73,7 +73,7 @@ std::string exec(const std::string_view& command, bool capture_output) noexcept
|
||||
bool prompt_char(const char* prompt, const char* color, char* read) noexcept {
|
||||
fmt::print("{}{}{}\n", color, prompt, RESET);
|
||||
|
||||
std::string tmp;
|
||||
std::string tmp{};
|
||||
if (std::getline(std::cin, tmp)) {
|
||||
char read_char{};
|
||||
if (tmp.length() == 1) {
|
||||
@ -127,12 +127,12 @@ void id_system() noexcept {
|
||||
}
|
||||
|
||||
bool handle_connection() noexcept {
|
||||
bool connected;
|
||||
bool connected{};
|
||||
|
||||
if (!(connected = utils::is_connected())) {
|
||||
warning("An active network connection could not be detected, waiting 15 seconds ...\n");
|
||||
|
||||
int32_t time_waited = 0;
|
||||
std::int32_t time_waited{};
|
||||
|
||||
while (!(connected = utils::is_connected())) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
@ -143,7 +143,7 @@ bool handle_connection() noexcept {
|
||||
}
|
||||
|
||||
if (!connected) {
|
||||
char type = '\0';
|
||||
char type{};
|
||||
|
||||
while (utils::prompt_char("An active network connection could not be detected, do you want to connect using wifi? [y/n]", RED, &type)) {
|
||||
if (type != 'n') {
|
||||
|
@ -1,6 +1,6 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/libcpr/cpr.git
|
||||
revision = bcb7729dd6d930820fb858f63c97ad559241b789
|
||||
url = https://github.com/vnepogodin/cpr.git
|
||||
revision = 824358455f61629ca43422adce0243bb05e99bf8
|
||||
|
||||
patch_directory = cpr
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user