fix: reenable enter_accept for bash (#1408)

* fix: reenable enter_accept for bash

* fix: Fix the shellcheck warnings
This commit is contained in:
Patrick Jackson 2023-12-05 09:56:47 -08:00 committed by GitHub
parent 839965a8d7
commit a52568be79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -705,7 +705,7 @@ pub async fn history(
if index < results.len() {
let mut command = results.swap_remove(index).command;
if accept && (utils::is_zsh() || utils::is_fish()) {
if accept && (utils::is_zsh() || utils::is_fish() || utils::is_bash()) {
command = String::from("__atuin_accept__:") + &command;
}

View File

@ -1,4 +1,5 @@
ATUIN_SESSION=$(atuin uuid)
ATUIN_STTY=$(stty -g)
export ATUIN_SESSION
__atuin_preexec() {
@ -53,8 +54,16 @@ __atuin_history() {
# shellcheck disable=SC2154
__bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command"
fi
# Juggle the terminal settings so that the command can be interacted with
local stty_backup
stty_backup=$(stty -g)
stty "$ATUIN_STTY"
eval "$HISTORY"
exit_status=$?
stty "$stty_backup"
# Execute preprompt commands
__atuin_set_ret_value "$exit_status" "$HISTORY"
eval "$PROMPT_COMMAND"