Skip to content
Snippets Groups Projects
Commit b60fc559 authored by yaphet's avatar yaphet Committed by dutor
Browse files

Support semicolon at the end of the console's local commands (#384)

* support semicolon in console command

* using while to determine the loop ending
parent bd3b778d
No related branches found
No related tags found
No related merge requests found
......@@ -312,7 +312,8 @@ void CmdProcessor::printData(const cpp2::ExecutionResponse& resp,
bool CmdProcessor::processClientCmd(folly::StringPiece cmd,
bool& readyToExit) {
if (cmd == "exit") {
normalize(cmd);
if (cmd == "exit" || cmd== "quit") {
readyToExit = true;
return true;
} else {
......@@ -381,6 +382,14 @@ bool CmdProcessor::process(folly::StringPiece cmd) {
return true;
}
void CmdProcessor::normalize(folly::StringPiece &command) {
command = folly::trimWhitespace(command);
while (command.endsWith(";")) {
command = command.subpiece(0, command.size() - 1);
command = folly::trimWhitespace(command);
}
}
} // namespace graph
} // namespace nebula
......@@ -45,6 +45,8 @@ private:
const std::string& rowLine,
const std::vector<size_t>& widths,
const std::vector<std::string>& formats) const;
void normalize(folly::StringPiece &command);
};
} // namespace graph
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment