Skip to content

Commit

Permalink
fix(cli): append space for appending mutiline query (#97)
Browse files Browse the repository at this point in the history
* fix(cli): append space for appending mutiline query

* fix(cli): use full host for prompt
  • Loading branch information
everpcpc authored Apr 26, 2023
1 parent 4eb5c45 commit 217c250
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions cli/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,8 @@ impl Session {
"> ".to_owned()
} else {
let info = self.conn.info();
let tokens = info.host.split('.').collect::<Vec<_>>();
let host = if tokens.len() >= 2 {
tokens[..2].join(".")
} else {
info.host
};
let mut prompt = self.settings.prompt.clone();
prompt = prompt.replace("{host}", &host);
prompt = prompt.replace("{host}", &info.host);
prompt = prompt.replace("{user}", &info.user);
prompt = prompt.replace("{port}", &info.port.to_string());
format!("{} ", prompt.trim_end())
Expand Down Expand Up @@ -185,6 +179,7 @@ impl Session {
return vec![line.to_owned()];
}

self.query.push(' ');
self.query.push_str(line);

let mut queries = Vec::new();
Expand Down

0 comments on commit 217c250

Please sign in to comment.