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.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/gentoobrowse-api/util/update.cpp b/gentoobrowse-api/util/update.cpp
index 4c4b1dd..ab4d2a5 100644
--- a/gentoobrowse-api/util/update.cpp
+++ b/gentoobrowse-api/util/update.cpp
@@ -1,6 +1,6 @@
-#include <maintenance.h>
#include <Ice/Ice.h>
#include <boost/program_options.hpp>
+#include <maintenance.h>
namespace po = boost::program_options;
@@ -10,15 +10,12 @@ main(int c, char ** v)
std::string endpoint;
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")
- ("background,b", po::value(&background)->default_value(false)->zero_tokens(), "Background")
- ("bugs", po::value(&bugs)->default_value(true), "Update bugs")
- ("tree", po::value(&tree)->default_value(true), "Update tree")
- ("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")
- ;
+ opts.add_options()("endpoint", po::value(&endpoint)->default_value("tcp -p 9001"), "Service endpoint")(
+ "background,b", po::value(&background)->default_value(false)->zero_tokens(), "Background")("bugs",
+ po::value(&bugs)->default_value(true),
+ "Update bugs")("tree", po::value(&tree)->default_value(true), "Update tree")(
+ "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);
@@ -34,21 +31,24 @@ main(int c, char ** v)
m->ice_ping();
std::vector<std::future<void>> jobs;
- if (bugs) jobs.push_back(m->refreshBugsAsync());
- if (pull) m->updateRepositories();
- if (tree) jobs.push_back(m->refreshPackageTreeAsync());
+ if (bugs)
+ jobs.push_back(m->refreshBugsAsync());
+ if (pull)
+ m->updateRepositories();
+ if (tree)
+ jobs.push_back(m->refreshPackageTreeAsync());
int failures = 0;
if (!background) {
std::for_each(jobs.begin(), jobs.end(), [&failures](auto & f) {
- try {
- f.get();
- }
- catch (const std::exception & ex) {
- failures += 1;
- std::cerr << ex.what() << std::endl;
- }
- });
+ try {
+ f.get();
+ }
+ catch (const std::exception & ex) {
+ failures += 1;
+ std::cerr << ex.what() << std::endl;
+ }
+ });
if (sendNotifications) {
m->sendNotifications();
}
@@ -58,4 +58,3 @@ main(int c, char ** v)
ic->destroy();
return failures;
}
-