diff options
| author | sigoden <sigoden@gmail.com> | 2024-12-01 10:06:20 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-01 10:06:20 +0800 |
| commit | 7e8e2a6ce6d96ffa31c202ead6f31f18dc73c618 (patch) | |
| tree | 907070ab6f81ebef46a1ae8793b553c99b2dd52e /src/main.rs | |
| parent | efdec3497976ddb2e35e6302ee68f3d753f837a3 (diff) | |
| download | aichat-7e8e2a6ce6d96ffa31c202ead6f31f18dc73c618.tar.gz | |
feat: append shell execute command to history file (#1026)
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index d8f66f8..2cefaf3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -259,9 +259,10 @@ async fn shell_execute( "e" => { debug!("{} {:?}", shell.cmd, &[&shell.arg, &eval_str]); let code = run_command(&shell.cmd, &[&shell.arg, &eval_str], None)?; - if code != 0 { - process::exit(code); + if code == 0 && config.read().append_command_to_history_file { + let _ = append_to_shell_history(&shell.name, &eval_str, code); } + process::exit(code); } "r" => { let revision = Text::new("Enter your revision:").prompt()?; |
