Save history when leaving with Ctrl-C

This commit is contained in:
Pirmin Kalberer 2019-09-19 22:55:53 +02:00
parent df7a3a4863
commit 484d8c26ac
2 changed files with 3 additions and 2 deletions

View File

@ -399,6 +399,7 @@ pub async fn cli() -> Result<(), Box<dyn Error>> {
LineResult::CtrlC => {
if ctrlcbreak {
let _ = rl.save_history(&History::path());
std::process::exit(0);
} else {
context.with_host(|host| host.stdout("CTRL-C pressed (again to quit)"));

View File

@ -130,7 +130,7 @@ impl InternalCommand {
CommandAction::AddSpanSource(uuid, span_source) => {
context.add_span_source(uuid, span_source);
}
CommandAction::Exit => std::process::exit(0),
CommandAction::Exit => std::process::exit(0), // TODO: save history.txt
CommandAction::EnterHelpShell(value) => {
match value {
Tagged {
@ -170,7 +170,7 @@ impl InternalCommand {
CommandAction::LeaveShell => {
context.shell_manager.remove_at_current();
if context.shell_manager.is_empty() {
std::process::exit(0);
std::process::exit(0); // TODO: save history.txt
}
}
},