| 251 | // Entry point |
| 252 | |
| 253 | int main() |
| 254 | { |
| 255 | try |
| 256 | { |
| 257 | CmdHandler colorCmd; |
| 258 | CmdHandler nocolorCmd; |
| 259 | |
| 260 | // setup cli |
| 261 | |
| 262 | auto rootMenu = make_unique< Menu >( "cli" ); |
| 263 | PluginContainer::Instance().SetMenu(*rootMenu); |
| 264 | rootMenu->Insert( |
| 265 | "list", |
| 266 | [](std::ostream& out){ PluginRegistry::Instance().Print(out); }, |
| 267 | "Print the plugin list" ); |
| 268 | rootMenu->Insert( |
| 269 | "loaded", |
| 270 | [](std::ostream& out) |
| 271 | { |
| 272 | PluginContainer::Instance().PrintLoaded(out); |
| 273 | }, |
| 274 | "Load the plugin specified" ); |
| 275 | rootMenu->Insert( |
| 276 | "load", {"plugin_name"}, |
| 277 | [](std::ostream&, const string& plugin) |
| 278 | { |
| 279 | PluginContainer::Instance().Load(plugin); |
| 280 | }, |
| 281 | "Load the plugin specified" ); |
| 282 | rootMenu->Insert( |
| 283 | "unload", {"plugin_name"}, |
| 284 | [](std::ostream&, const string& plugin) |
| 285 | { |
| 286 | PluginContainer::Instance().Unload(plugin); |
| 287 | }, |
| 288 | "Unload the plugin specified" ); |
| 289 | colorCmd = rootMenu -> Insert( |
| 290 | "color", |
| 291 | [&](std::ostream& out) |
| 292 | { |
| 293 | out << "Colors ON\n"; |
| 294 | SetColor(); |
| 295 | colorCmd.Disable(); |
| 296 | nocolorCmd.Enable(); |
| 297 | }, |
| 298 | "Enable colors in the cli" ); |
| 299 | nocolorCmd = rootMenu -> Insert( |
| 300 | "nocolor", |
| 301 | [&](std::ostream& out) |
| 302 | { |
| 303 | out << "Colors OFF\n"; |
| 304 | SetNoColor(); |
| 305 | colorCmd.Enable(); |
| 306 | nocolorCmd.Disable(); |
| 307 | }, |
| 308 | "Disable colors in the cli" ); |
| 309 | |
| 310 |
nothing calls this directly
no test coverage detected