9 #ifndef PACKAGER_APP_VALIDATE_FLAG_H_
10 #define PACKAGER_APP_VALIDATE_FLAG_H_
14 #include <absl/strings/str_format.h>
20 void PrintError(
const std::string& error_message);
36 template <
class FlagType>
38 const FlagType& flag_value,
42 if (flag_value.empty()) {
43 if (!optional && condition) {
44 PrintError(absl::StrFormat(
"--%s is required if %s.", flag_name, label));
47 }
else if (!condition) {
48 PrintError(absl::StrFormat(
"--%s should be specified only if %s.",
All the methods that are virtual are virtual for mocking.
void PrintWarning(const std::string &warning_message)
void PrintError(const std::string &error_message)
bool ValidateFlag(const char *flag_name, const FlagType &flag_value, bool condition, bool optional, const char *label)