From 853d7471c2736a1804f05f193215c43645037b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Tue, 14 Jun 2016 18:47:02 +0200 Subject: [PATCH] Added error message when using command-line options incorrectly. --- apps/plasp-app/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/plasp-app/main.cpp b/apps/plasp-app/main.cpp index 7bacfae..dc9c2c5 100644 --- a/apps/plasp-app/main.cpp +++ b/apps/plasp-app/main.cpp @@ -76,6 +76,15 @@ int main(int argc, char **argv) logger.setWarningLevel(plasp::utils::Logger::WarningLevel::Error); else if (warningLevel == "ignore") logger.setWarningLevel(plasp::utils::Logger::WarningLevel::Ignore); + else if (warningLevel == "normal") + logger.setWarningLevel(plasp::utils::Logger::WarningLevel::Normal); + else + { + logger.logError("unknown warning level “" + warningLevel + "”"); + std::cout << std::endl; + printHelp(); + return EXIT_FAILURE; + } const auto colorPolicy = variablesMap["color"].as(); @@ -85,6 +94,13 @@ int main(int argc, char **argv) logger.setColorPolicy(plasp::utils::LogStream::ColorPolicy::Never); else if (colorPolicy == "always") logger.setColorPolicy(plasp::utils::LogStream::ColorPolicy::Always); + else + { + logger.logError("unknown color policy “" + colorPolicy + "”"); + std::cout << std::endl; + printHelp(); + return EXIT_FAILURE; + } try {