diff options
Diffstat (limited to 'src/zen/cmds/run_cmd.cpp')
| -rw-r--r-- | src/zen/cmds/run_cmd.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/zen/cmds/run_cmd.cpp b/src/zen/cmds/run_cmd.cpp index 309b8996a..00ab16fe5 100644 --- a/src/zen/cmds/run_cmd.cpp +++ b/src/zen/cmds/run_cmd.cpp @@ -57,32 +57,32 @@ RunCommand::~RunCommand() { } -int +void RunCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) { - ZEN_UNUSED(GlobalOptions); - if (!ParseOptions(argc, argv)) { - return 0; + return; } // Validate arguments if (GlobalOptions.PassthroughArgV.empty() || GlobalOptions.PassthroughArgV[0].empty()) - throw OptionParseException("No command specified. The command to run is passed in after a double dash ('--') on the command line"); + throw OptionParseException("No command specified. The command to run is passed in after a double dash ('--') on the command line", + m_Options.help()); if (m_RunCount < 0) - throw OptionParseException("Invalid count specified"); + throw OptionParseException(fmt::format("'--count' ('{}') is invalid", m_RunCount), m_Options.help()); if (m_RunTime < -1 || m_RunTime == 0) - throw OptionParseException("Invalid run time specified"); + throw OptionParseException(fmt::format("'--time' ('{}') is invalid", m_RunTime), m_Options.help()); if (m_MaxBaseDirectoryCount < 0) - throw OptionParseException("Invalid directory count specified"); + throw OptionParseException(fmt::format("'--max-dirs' ('{}') is invalid", m_MaxBaseDirectoryCount), m_Options.help()); if (m_RunTime > 0 && m_RunCount > 0) - throw OptionParseException("Specify either time or count, not both"); + throw OptionParseException(fmt::format("'--time' ('{}') conflicts with '--count' ('{}') ", m_RunTime, m_RunCount), + m_Options.help()); if (m_RunCount == 0) m_RunCount = 1; @@ -190,8 +190,6 @@ RunCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) { fmt::print("run complete, no error exit code\n", m_RunCount); } - - return 0; } } // namespace zen |