From b6a5fcfd842a5803496a09f5d03c68c34e919f1e Mon Sep 17 00:00:00 2001 From: TimQu Date: Tue, 21 May 2019 10:12:01 +0200 Subject: [PATCH] Settings: Do not hard-code executable name in help message. --- src/storm-cli-utilities/cli.cpp | 2 +- src/storm-conv-cli/storm-conv.cpp | 1 + src/storm/settings/SettingsManager.cpp | 25 ++++++++++++++++--------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/storm-cli-utilities/cli.cpp b/src/storm-cli-utilities/cli.cpp index 90b198fa9..c7b18fb7a 100644 --- a/src/storm-cli-utilities/cli.cpp +++ b/src/storm-cli-utilities/cli.cpp @@ -177,7 +177,7 @@ namespace storm { try { storm::settings::mutableManager().setFromCommandLine(argc, argv); } catch (storm::exceptions::OptionParserException& e) { - STORM_LOG_ERROR("Unable to parse command line options. Type 'storm --help' or 'storm --help all' for help."); + STORM_LOG_ERROR("Unable to parse command line options. Type '" + std::string(argv[0]) + " --help' or '" + std::string(argv[0]) + " --help all' for help."); return false; } diff --git a/src/storm-conv-cli/storm-conv.cpp b/src/storm-conv-cli/storm-conv.cpp index 1ef0823ea..1c333f93c 100644 --- a/src/storm-conv-cli/storm-conv.cpp +++ b/src/storm-conv-cli/storm-conv.cpp @@ -275,6 +275,7 @@ bool parseOptions(const int argc, const char* argv[]) { try { storm::settings::mutableManager().setFromCommandLine(argc, argv); } catch (storm::exceptions::OptionParserException& e) { + STORM_LOG_ERROR("Unable to parse command line options. Type '" + std::string(argv[0]) + " --help' or '" + std::string(argv[0]) + " --help all' for help."); return false; } diff --git a/src/storm/settings/SettingsManager.cpp b/src/storm/settings/SettingsManager.cpp index 099a77f46..04cb48621 100644 --- a/src/storm/settings/SettingsManager.cpp +++ b/src/storm/settings/SettingsManager.cpp @@ -240,15 +240,22 @@ namespace storm { } } } - if (numHidden > 0) { - STORM_PRINT(numHidden << " hidden options." << std::endl); - } - if (!invisibleModules.empty()) { - STORM_PRINT(invisibleModules.size() << " hidden modules (" << boost::join(invisibleModules, ", ") << ")." << std::endl); - } - if (numHidden > 0 || !invisibleModules.empty()) { - STORM_PRINT(std::endl << "Type 'storm --help modulename' to display all options of a specific module or 'storm --help all' for a complete list of options." << std::endl); - } + if (!includeAdvanced) { + if (numHidden == 1) { + STORM_PRINT(numHidden << " hidden option." << std::endl); + } else { + STORM_PRINT(numHidden << " hidden options." << std::endl); + } + if (!invisibleModules.empty()) { + if (invisibleModules.size() == 1) { + STORM_PRINT(invisibleModules.size() << " hidden module (" << boost::join(invisibleModules, ", ") << ")." << std::endl); + } else { + STORM_PRINT(invisibleModules.size() << " hidden modules (" << boost::join(invisibleModules, ", ") << ")." << std::endl); + } + } + STORM_PRINT(std::endl << "Type '" + executableName + " --help modulename' to display all options of a specific module." << std::endl); + STORM_PRINT("Type '" + executableName + " --help all' to display a complete list of options." << std::endl); + } } else { // Create a regular expression from the input hint. std::regex hintRegex(filter, std::regex_constants::ECMAScript | std::regex_constants::icase);