10 #include <mrpt/3rdparty/tclap/CmdLine.h> 11 #include <mrpt/core/exceptions.h> 12 #include <mrpt/system/CTicTac.h> 13 #include <mrpt/system/os.h> 14 #include <mrpt/version.h> 24 std::unique_ptr<cli_flags>
cli;
36 #if MRPT_VERSION >= 0x233 37 mrpt::system::consoleColorAndStyle(
38 mrpt::system::ConsoleForegroundColor::RED);
40 mrpt::system::setConsoleColor(mrpt::system::CONCOL_RED);
46 #if MRPT_VERSION >= 0x233 47 mrpt::system::consoleColorAndStyle(
48 mrpt::system::ConsoleForegroundColor::DEFAULT);
50 mrpt::system::setConsoleColor(mrpt::system::CONCOL_NORMAL);
54 int main(
int argc,
char** argv)
58 cli = std::make_unique<cli_flags>();
60 if (!
cli->cmd.parse(argc, argv))
66 if (
cli->argVersion.isSet())
74 if (
const auto& lst =
cli->argCmd.getValue(); !lst.empty())
82 if (!
cli->argHelp.isSet())
85 std::cerr <<
"Error: missing or unknown command.\n";
93 return (itCmd->second)();
95 catch (
const std::exception& e)
97 std::cerr <<
"ERROR: " << mrpt::exception_to_str(e);
107 R
"XXX(mvsim v%s: A lightweight multivehicle simulation environment. 110 mvsim launch <WORLD.xml> Start a comm. server and simulates a world. 111 mvsim server Start a standalone communication server. 112 mvsim node List connected nodes, etc. 113 mvsim topic Inspect, publish, etc. topics. 114 mvsim --version Shows program version. 115 mvsim --help Shows this information. 117 Or use `mvsim <COMMAND> --help` for further options
const std::map< std::string, cmd_t > cliCommands
std::function< int(void)> cmd_t
void setConsoleErrorColor()
int launchStandAloneServer()
int main(int argc, char **argv)
ROSLIB_DECL std::string command(const std::string &cmd)
std::unique_ptr< cli_flags > cli
void setConsoleNormalColor()