summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/util/update.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gentoobrowse-api/util/update.cpp')
-rw-r--r--gentoobrowse-api/util/update.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/gentoobrowse-api/util/update.cpp b/gentoobrowse-api/util/update.cpp
index f00cd0b..7f67ada 100644
--- a/gentoobrowse-api/util/update.cpp
+++ b/gentoobrowse-api/util/update.cpp
@@ -9,17 +9,16 @@
#include <exception>
#include <future>
#include <iostream>
-#include <memory>
#include <string>
#include <vector>
namespace po = boost::program_options;
int
-main(int c, char ** v)
+main(int argc, char ** argv)
{
std::string endpoint;
- bool background, tree, bugs, sendNotifications, pull;
+ bool background {}, tree {}, bugs {}, sendNotifications {}, pull {};
{
po::options_description opts("Gentoo Browse Util::Update options");
opts.add_options()("endpoint", po::value(&endpoint)->default_value("tcp -p 9001"), "Service endpoint")(
@@ -29,48 +28,48 @@ main(int c, char ** v)
"pull", po::value(&pull)->default_value(true), "Perform a git pull on repositories")("notifications",
po::value(&sendNotifications)->default_value(true), "Send notification emails")("help,h", "Show help");
- po::variables_map vm;
- po::store(po::command_line_parser(c, v).options(opts).run(), vm);
- po::notify(vm);
+ po::variables_map varmap;
+ po::store(po::command_line_parser(argc, argv).options(opts).run(), varmap);
+ po::notify(varmap);
- if (vm.count("help")) {
- std::cerr << opts << std::endl;
- exit(1);
+ if (varmap.contains("help")) {
+ std::cerr << opts << '\n';
+ exit(EXIT_FAILURE);
}
}
- auto ic = Ice::initialize(c, v);
- auto m = Ice::checkedCast<Gentoo::MaintenancePrx>(ic->stringToProxy("maintenance:" + endpoint));
- m->ice_ping();
+ auto ice = Ice::initialize(argc, argv);
+ auto maintPrx = Ice::checkedCast<Gentoo::MaintenancePrx>(ice->stringToProxy("maintenance:" + endpoint));
+ maintPrx->ice_ping();
std::vector<std::future<void>> jobs;
if (bugs) {
- jobs.push_back(m->refreshBugsAsync());
+ jobs.push_back(maintPrx->refreshBugsAsync());
}
if (pull) {
- m->updateRepositories();
+ maintPrx->updateRepositories();
}
if (tree) {
- jobs.push_back(m->refreshPackageTreeAsync());
+ jobs.push_back(maintPrx->refreshPackageTreeAsync());
}
int failures = 0;
if (!background) {
- std::for_each(jobs.begin(), jobs.end(), [&failures](auto & f) {
+ std::ranges::for_each(jobs, [&failures](auto & future) {
try {
- f.get();
+ future.get();
}
catch (const std::exception & ex) {
failures += 1;
- std::cerr << ex.what() << std::endl;
+ std::cerr << ex.what() << '\n';
}
});
if (sendNotifications) {
- m->sendNotifications();
+ maintPrx->sendNotifications();
}
}
jobs.clear();
- ic->destroy();
+ ice->destroy();
return failures;
}