mirror of
https://github.com/nushell/nushell
synced 2025-01-13 05:38:57 +00:00
Save history when leaving with Ctrl-C
This commit is contained in:
parent
df7a3a4863
commit
484d8c26ac
2 changed files with 3 additions and 2 deletions
|
@ -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)"));
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue