Skip to content

Commit

Permalink
fix: database in ns_client (#2139)
Browse files Browse the repository at this point in the history
  • Loading branch information
dl239 authored Jul 12, 2022
1 parent 0f64e4a commit 8a58d94
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cmd/openmldb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3682,7 +3682,7 @@ void StartClient() {
void StartNsClient() {
std::string endpoint;
std::string real_endpoint;
if (FLAGS_interactive) {
if (FLAGS_cmd.empty()) {
std::cout << "Welcome to openmldb with version " << OPENMLDB_VERSION << std::endl;
}
std::shared_ptr<::openmldb::zk::ZkClient> zk_client;
Expand Down Expand Up @@ -3746,8 +3746,12 @@ void StartNsClient() {
std::string buffer;
display_prefix = endpoint + " " + client.GetDb() + "> ";
multi_line_perfix = std::string(display_prefix.length() - 3, ' ') + "-> ";
if (!FLAGS_interactive) {
if (!FLAGS_cmd.empty()) {
buffer = FLAGS_cmd;
if (!FLAGS_database.empty()) {
std::string error;
client.Use(FLAGS_database, error);
}
} else {
char* line = ::openmldb::base::linenoise(multi_line ? multi_line_perfix.c_str() : display_prefix.c_str());
if (line == NULL) {
Expand Down

0 comments on commit 8a58d94

Please sign in to comment.