Skip to content

Commit

Permalink
Fix dry run warnings (#59)
Browse files Browse the repository at this point in the history
* Fix dry run warnings

Signed-off-by: Lucas Gracioso <[email protected]>

* Change order

Signed-off-by: Lucas Gracioso <[email protected]>

---------

Signed-off-by: Lucas Gracioso <[email protected]>
  • Loading branch information
lbgracioso committed May 8, 2024
1 parent 5639860 commit af32d3f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/repos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ std::vector<std::string> Repos::getxCATOSImageRepos() const

void Repos::configureRepositories() const
{
if (cloyster::dryRun) {
LOG_INFO("Would create and configure repositories")
return;
}

LOG_INFO("Setting up repositories")

createCloysterRepo();
Expand Down

0 comments on commit af32d3f

Please sign in to comment.