mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-19 06:55:18 +01:00
consume remaining
This commit is contained in:
@@ -484,7 +484,7 @@ impl Limbo {
|
||||
}
|
||||
|
||||
// consume will consume `input_buff`
|
||||
pub fn consume(&mut self) -> anyhow::Result<()> {
|
||||
pub fn consume(&mut self, flush: bool) -> anyhow::Result<()> {
|
||||
if self.input_buff.trim().is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
@@ -503,6 +503,10 @@ impl Limbo {
|
||||
self.run_query(value);
|
||||
self.reset_input();
|
||||
}
|
||||
(false, false) if flush => {
|
||||
self.run_query(value);
|
||||
self.reset_input();
|
||||
}
|
||||
(false, false) => {
|
||||
self.set_multiline_prompt();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
loop {
|
||||
match app.readline() {
|
||||
Ok(_) => match app.consume() {
|
||||
Ok(_) => match app.consume(false) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
eprintln!("{e}");
|
||||
@@ -83,7 +83,7 @@ fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
Err(ReadlineError::Eof) => {
|
||||
// consume remaining input before exit
|
||||
match app.consume() {
|
||||
match app.consume(true) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
eprintln!("{e}");
|
||||
|
||||
Reference in New Issue
Block a user