| 410 | } |
| 411 | |
| 412 | int EmbeddedShell::processShellCommands(std::string lineStr) { |
| 413 | std::istringstream iss(lineStr); |
| 414 | std::string command, arg; |
| 415 | iss >> command >> arg; |
| 416 | if (command == shellCommand.HELP) { |
| 417 | printHelp(); |
| 418 | } else if (command == shellCommand.CLEAR) { |
| 419 | linenoiseClearScreen(); |
| 420 | } else if (command == shellCommand.QUIT) { |
| 421 | return -1; |
| 422 | } else if (command == shellCommand.MAX_ROWS) { |
| 423 | setMaxRows(arg); |
| 424 | } else if (command == shellCommand.MAX_WIDTH) { |
| 425 | setMaxWidth(arg); |
| 426 | } else if (command == shellCommand.MODE) { |
| 427 | setMode(arg); |
| 428 | } else if (command == shellCommand.STATS) { |
| 429 | setStats(arg); |
| 430 | } else if (command == shellCommand.MULTI) { |
| 431 | setLinenoiseMode(1); |
| 432 | } else if (command == shellCommand.SINGLE) { |
| 433 | setLinenoiseMode(0); |
| 434 | } else if (command == shellCommand.HIGHLIGHT) { |
| 435 | setHighlighting(arg); |
| 436 | } else if (command == shellCommand.ERRORS) { |
| 437 | setErrors(arg); |
| 438 | } else if (command == shellCommand.COMPLETE) { |
| 439 | setComplete(arg); |
| 440 | } else if (command == shellCommand.SCHEMA) { |
| 441 | printSchema(); |
| 442 | } else { |
| 443 | printf("Error: Unknown command: \"%s\". Enter \":help\" for help\n", lineStr.c_str()); |
| 444 | printf("Did you mean: \"%s\"?\n", findClosestCommand(lineStr).c_str()); |
| 445 | } |
| 446 | return 0; |
| 447 | } |
| 448 | |
| 449 | EmbeddedShell::EmbeddedShell(std::shared_ptr<Database> database, std::shared_ptr<Connection> conn, |
| 450 | ShellConfig& shellConfig) { |
nothing calls this directly
no test coverage detected