Enable :memory: as default option for cli when no DB provided

This commit is contained in:
PThorpe92 2024-12-14 17:58:18 -05:00
parent a323db6f46
commit 49f8429cc0
No known key found for this signature in database
GPG key ID: 66DB3FBACBDD05CC
2 changed files with 44 additions and 46 deletions

View file

@ -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)
}
}