mirror of
https://github.com/nushell/nushell.git
synced 2024-10-17 07:42:53 +02:00
Save history when leaving with Ctrl-C
This commit is contained in:
parent
df7a3a4863
commit
484d8c26ac
@ -399,6 +399,7 @@ pub async fn cli() -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
LineResult::CtrlC => {
|
LineResult::CtrlC => {
|
||||||
if ctrlcbreak {
|
if ctrlcbreak {
|
||||||
|
let _ = rl.save_history(&History::path());
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
} else {
|
} else {
|
||||||
context.with_host(|host| host.stdout("CTRL-C pressed (again to quit)"));
|
context.with_host(|host| host.stdout("CTRL-C pressed (again to quit)"));
|
||||||
|
@ -130,7 +130,7 @@ impl InternalCommand {
|
|||||||
CommandAction::AddSpanSource(uuid, span_source) => {
|
CommandAction::AddSpanSource(uuid, span_source) => {
|
||||||
context.add_span_source(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) => {
|
CommandAction::EnterHelpShell(value) => {
|
||||||
match value {
|
match value {
|
||||||
Tagged {
|
Tagged {
|
||||||
@ -170,7 +170,7 @@ impl InternalCommand {
|
|||||||
CommandAction::LeaveShell => {
|
CommandAction::LeaveShell => {
|
||||||
context.shell_manager.remove_at_current();
|
context.shell_manager.remove_at_current();
|
||||||
if context.shell_manager.is_empty() {
|
if context.shell_manager.is_empty() {
|
||||||
std::process::exit(0);
|
std::process::exit(0); // TODO: save history.txt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user