diff options
Diffstat (limited to 'gentoobrowse-api/util/update.cpp')
-rw-r--r-- | gentoobrowse-api/util/update.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/gentoobrowse-api/util/update.cpp b/gentoobrowse-api/util/update.cpp index ab4d2a5..2af64a9 100644 --- a/gentoobrowse-api/util/update.cpp +++ b/gentoobrowse-api/util/update.cpp @@ -9,21 +9,23 @@ 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"); - - po::variables_map vm; - po::store(po::command_line_parser(c, v).options(opts).run(), vm); - po::notify(vm); - - if (vm.count("help")) { - std::cerr << opts << std::endl; - exit(1); + { + 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"); + + po::variables_map vm; + po::store(po::command_line_parser(c, v).options(opts).run(), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cerr << opts << std::endl; + exit(1); + } } auto ic = Ice::initialize(c, v); @@ -31,12 +33,15 @@ main(int c, char ** v) m->ice_ping(); std::vector<std::future<void>> jobs; - if (bugs) + if (bugs) { jobs.push_back(m->refreshBugsAsync()); - if (pull) + } + if (pull) { m->updateRepositories(); - if (tree) + } + if (tree) { jobs.push_back(m->refreshPackageTreeAsync()); + } int failures = 0; if (!background) { |