mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 01:58:16 +00:00
Enable :memory: as default option for cli when no DB provided
This commit is contained in:
parent
a323db6f46
commit
49f8429cc0
2 changed files with 44 additions and 46 deletions
17
cli/main.rs
17
cli/main.rs
|
@ -3,8 +3,13 @@ mod opcodes_dictionary;
|
|||
|
||||
use clap::Parser;
|
||||
use rustyline::{error::ReadlineError, DefaultEditor};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
io::IsTerminal,
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc,
|
||||
},
|
||||
};
|
||||
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
fn main() -> anyhow::Result<()> {
|
||||
|
@ -29,8 +34,6 @@ fn main() -> anyhow::Result<()> {
|
|||
}
|
||||
return Ok(());
|
||||
}
|
||||
println!("Limbo v{}", env!("CARGO_PKG_VERSION"));
|
||||
println!("Enter \".help\" for usage hints.");
|
||||
let mut rl = DefaultEditor::new()?;
|
||||
let home = dirs::home_dir().expect("Could not determine home directory");
|
||||
let history_file = home.join(".limbo_history");
|
||||
|
@ -50,7 +53,7 @@ fn main() -> anyhow::Result<()> {
|
|||
// At prompt, increment interrupt count
|
||||
if interrupt_count.fetch_add(1, Ordering::SeqCst) >= 1 {
|
||||
eprintln!("Interrupted. Exiting...");
|
||||
app.close_conn();
|
||||
let _ = app.close_conn();
|
||||
break;
|
||||
}
|
||||
println!("Use .quit to exit or press Ctrl-C again to force quit.");
|
||||
|
@ -58,11 +61,11 @@ fn main() -> anyhow::Result<()> {
|
|||
continue;
|
||||
}
|
||||
Err(ReadlineError::Eof) => {
|
||||
app.close_conn();
|
||||
let _ = app.close_conn();
|
||||
break;
|
||||
}
|
||||
Err(err) => {
|
||||
app.close_conn();
|
||||
let _ = app.close_conn();
|
||||
anyhow::bail!(err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue