1 // 2 // Copyright © 2020 Arm Ltd. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 6 #pragma once 7 8 #include <cxxopts/cxxopts.hpp> 9 10 /** 11 * Ensure all mandatory command-line parameters have been passed to cxxopts. 12 * @param result returned from the cxxopts parse(argc, argv) call 13 * @param required vector of strings listing the mandatory parameters to be input from the command-line 14 * @return boolean value - true if all required parameters satisfied, false otherwise 15 * */ CheckRequiredOptions(const cxxopts::ParseResult & result,const std::vector<std::string> & required)16inline bool CheckRequiredOptions(const cxxopts::ParseResult& result, const std::vector<std::string>& required) 17 { 18 for(const std::string& str : required) 19 { 20 if(result.count(str) == 0) 21 { 22 std::cerr << "--" << str << " parameter is mandatory" << std::endl; 23 return false; 24 } 25 } 26 return true; 27 } 28