/* * This file is part of the BuildIt software distribution (https://gitea.federationhq.de/byterazor/repobadge) * Copyright (c) 2020 Dominik Meyer . * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include void usage(std::string name) { std::cout << "USAGE: " << name << " " << std::endl; std::cout << " color is optional" << std::endl; } int main(int argc, char **argv) { // check for help request if (argc == 2) { if (std::string(argv[1]) == "-h" || std::string(argv[1]) == "--help") { usage(argv[0]); return 0; } } else if (argc == 3) { std::string left(argv[1]); std::string right(argv[2]); repoBadge::Badge badge(left, right, repoBadge::BadgeColor::BRIGHTGREEN); std::cout << badge.create(); } else if (argc == 4) { std::string left(argv[1]); std::string right(argv[2]); std::string color(argv[3]); repoBadge::Badge badge(left, right, color ); std::cout << badge.create(); } else { std::cerr << "Error: parameter missing" << std::endl; usage(std::string(argv[0])); return 1; } };