| 1283 | } |
| 1284 | |
| 1285 | command_result df_tiletypes (color_ostream &out_, vector <string> & parameters) |
| 1286 | { |
| 1287 | for(size_t i = 0; i < parameters.size();i++) |
| 1288 | { |
| 1289 | if(parameters[i] == "help" || parameters[i] == "?") |
| 1290 | { |
| 1291 | return CR_WRONG_USAGE; |
| 1292 | } |
| 1293 | } |
| 1294 | |
| 1295 | if(!out_.is_console()) |
| 1296 | return CR_FAILURE; |
| 1297 | Console &out = static_cast<Console&>(out_); |
| 1298 | |
| 1299 | std::vector<std::string> commands; |
| 1300 | bool end = false; |
| 1301 | out << "Welcome to the tiletype tool.\nType 'help' or '?' for a list of available commands, 'q' to quit.\nPress return after a command to confirm." << std::endl; |
| 1302 | out.printerr("THIS TOOL CAN BE DANGEROUS. YOU'VE BEEN WARNED.\n"); |
| 1303 | while (!end) |
| 1304 | { |
| 1305 | printState(out); |
| 1306 | |
| 1307 | std::string input = ""; |
| 1308 | int rv = 0; |
| 1309 | |
| 1310 | while ((rv = out.lineedit("tiletypes> ",input,tiletypes_hist)) |
| 1311 | == Console::RETRY); |
| 1312 | if (rv <= Console::FAILURE) |
| 1313 | return rv == Console::FAILURE ? CR_FAILURE : CR_OK; |
| 1314 | tiletypes_hist.add(input); |
| 1315 | |
| 1316 | commands.clear(); |
| 1317 | Core::cheap_tokenise(input, commands); |
| 1318 | |
| 1319 | { |
| 1320 | CoreSuspender suspend; |
| 1321 | command_result ret = processCommand(out, commands, 0, commands.size(), end, true); |
| 1322 | |
| 1323 | if (ret != CR_OK) |
| 1324 | return ret; |
| 1325 | } |
| 1326 | } |
| 1327 | return CR_OK; |
| 1328 | } |
| 1329 | |
| 1330 | command_result df_tiletypes_command (color_ostream &out, vector <string> & parameters) |
| 1331 | { |
nothing calls this directly
no test coverage detected