MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / processShellCommands

Method processShellCommands

tools/shell/embedded_shell.cpp:412–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412int 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
449EmbeddedShell::EmbeddedShell(std::shared_ptr<Database> database, std::shared_ptr<Connection> conn,
450 ShellConfig& shellConfig) {

Callers

nothing calls this directly

Calls 2

linenoiseClearScreenFunction · 0.85
findClosestCommandFunction · 0.85

Tested by

no test coverage detected