diff --git a/columnq-cli/src/main.rs b/columnq-cli/src/main.rs index 4a9bcc3..598f454 100644 --- a/columnq-cli/src/main.rs +++ b/columnq-cli/src/main.rs @@ -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; }