mirror of
https://github.com/roapi/roapi.git
synced 2026-06-05 21:04:02 +08:00
add exit/quit command to columnq-cli
This commit is contained in:
parent
f72299f142
commit
57a1779a95
@ -51,20 +51,22 @@ async fn console_loop(cq: &ColumnQ) -> anyhow::Result<()> {
|
||||
match readline.readline("columnq(sql)> ") {
|
||||
Ok(line) => {
|
||||
readline.add_history_entry(line.as_str());
|
||||
match cq.query_sql(&line).await {
|
||||
Ok(batches) => {
|
||||
pretty::print_batches(&batches)?;
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Error: {}", e);
|
||||
match line.as_ref() {
|
||||
"exit" | "quit" | "q" => {
|
||||
println!("Good bye!");
|
||||
break;
|
||||
}
|
||||
s => match cq.query_sql(s).await {
|
||||
Ok(batches) => {
|
||||
pretty::print_batches(&batches)?;
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Error: {}", e);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Err(ReadlineError::Interrupted) => {
|
||||
println!("Good bye!");
|
||||
break;
|
||||
}
|
||||
Err(ReadlineError::Eof) => {
|
||||
Err(ReadlineError::Interrupted) | Err(ReadlineError::Eof) => {
|
||||
println!("Good bye!");
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user