From af32d3f7cf47f51254d961ad32847988c3bde9ba Mon Sep 17 00:00:00 2001 From: Lucas Gracioso <34951068+lbgracioso@users.noreply.github.com> Date: Wed, 8 May 2024 19:23:45 -0300 Subject: [PATCH] Fix dry run warnings (#59) * Fix dry run warnings Signed-off-by: Lucas Gracioso <34951068+lbgracioso@users.noreply.github.com> * Change order Signed-off-by: Lucas Gracioso <34951068+lbgracioso@users.noreply.github.com> --------- Signed-off-by: Lucas Gracioso <34951068+lbgracioso@users.noreply.github.com> --- src/main.cpp | 32 ++++++++++++++++---------------- src/repos.cpp | 5 +++++ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 79f8768..d7fc854 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -100,22 +100,6 @@ int main(int argc, const char** argv) LOG_INFO("{} Started", productName); try { - while (!unattended) { - char response = 'N'; - fmt::print("{} will now modify your system, do you want to " - "continue? [Y/N]\n", - cloyster::productName); - std::cin >> response; - - if (response == 'Y' || response == 'y') { - LOG_INFO("Running {}.\n", cloyster::productName) - break; - } else if (response == 'N' || response == 'n') { - LOG_INFO("Stopping {}.\n", cloyster::productName); - return EXIT_SUCCESS; - } - } - if (cloyster::showVersion) { fmt::print("{}: Version {}\n", productName, productVersion); return EXIT_SUCCESS; @@ -127,6 +111,22 @@ int main(int argc, const char** argv) if (cloyster::dryRun) { fmt::print("Dry run enabled.\n"); + } else { + while (!unattended) { + char response = 'N'; + fmt::print("{} will now modify your system, do you want to " + "continue? [Y/N]\n", + cloyster::productName); + std::cin >> response; + + if (response == 'Y' || response == 'y') { + LOG_INFO("Running {}.\n", cloyster::productName) + break; + } else if (response == 'N' || response == 'n') { + LOG_INFO("Stopping {}.\n", cloyster::productName); + return EXIT_SUCCESS; + } + } } //@TODO implement CLI feature diff --git a/src/repos.cpp b/src/repos.cpp index a2476fe..56df815 100644 --- a/src/repos.cpp +++ b/src/repos.cpp @@ -236,6 +236,11 @@ std::vector Repos::getxCATOSImageRepos() const void Repos::configureRepositories() const { + if (cloyster::dryRun) { + LOG_INFO("Would create and configure repositories") + return; + } + LOG_INFO("Setting up repositories") createCloysterRepo();