mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Save history on exit
This commit is contained in:
parent
bde2d4f0a3
commit
33d230771f
1 changed files with 9 additions and 3 deletions
12
cli/app.rs
12
cli/app.rs
|
@ -558,11 +558,13 @@ impl Limbo {
|
|||
}
|
||||
Ok(cmd) => match cmd.command {
|
||||
Command::Exit(args) => {
|
||||
self.save_history();
|
||||
std::process::exit(args.code);
|
||||
}
|
||||
Command::Quit => {
|
||||
let _ = self.writeln("Exiting Limbo SQL Shell.");
|
||||
let _ = self.close_conn();
|
||||
self.save_history();
|
||||
std::process::exit(0)
|
||||
}
|
||||
Command::Open(args) => {
|
||||
|
@ -1008,12 +1010,16 @@ impl Limbo {
|
|||
Ok(input)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Limbo {
|
||||
fn drop(&mut self) {
|
||||
fn save_history(&mut self) {
|
||||
if let Some(rl) = &mut self.rl {
|
||||
let _ = rl.save_history(HISTORY_FILE.as_path());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Limbo {
|
||||
fn drop(&mut self) {
|
||||
self.save_history()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue