mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-05 19:08:17 +00:00
bash: upgrade to bash-preexec 0.6.0
https://github.com/rcaloras/bash-preexec/releases/tag/0.6.0 This is a small update for us because we've been using a patched version of this script in Ghostty for some time, and the 0.6.0 release includes most of the local changes we made as part of maintaining and improving our bash shell integration. - https://github.com/rcaloras/bash-preexec/pull/167 - https://github.com/rcaloras/bash-preexec/pull/170 We continue to maintain one local HISTCONTROL-related modification (#2478). There are a few upstream conversations related to HISTCONTROL that might eliminate the need for this local patch, so we may revisit that in the future.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
# Author: Ryan Caloras (ryan@bashhub.com)
|
||||
# Forked from Original Author: Glyph Lefkowitz
|
||||
#
|
||||
# V0.5.0
|
||||
# V0.6.0
|
||||
#
|
||||
|
||||
# General Usage:
|
||||
@@ -38,7 +38,7 @@
|
||||
# Make sure this is bash that's running and return otherwise.
|
||||
# Use POSIX syntax for this line:
|
||||
if [ -z "${BASH_VERSION-}" ]; then
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
# We only support Bash 3.1+.
|
||||
@@ -95,7 +95,7 @@ __bp_adjust_histcontrol() {
|
||||
# Replace ignoreboth with ignoredups
|
||||
if [[ "$histcontrol" == *"ignoreboth"* ]]; then
|
||||
histcontrol="ignoredups:${histcontrol//ignoreboth}"
|
||||
fi;
|
||||
fi
|
||||
export HISTCONTROL="$histcontrol"
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ __bp_sanitize_string() {
|
||||
# It sets a variable to indicate that the prompt was just displayed,
|
||||
# to allow the DEBUG trap to know that the next command is likely interactive.
|
||||
__bp_interactive_mode() {
|
||||
__bp_preexec_interactive_mode="on";
|
||||
__bp_preexec_interactive_mode="on"
|
||||
}
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ __bp_preexec_invoke_exec() {
|
||||
__bp_install() {
|
||||
# Exit if we already have this installed.
|
||||
if [[ "${PROMPT_COMMAND[*]:-}" == *"__bp_precmd_invoke_cmd"* ]]; then
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
trap '__bp_preexec_invoke_exec "$_"' DEBUG
|
||||
@@ -323,7 +323,7 @@ __bp_install() {
|
||||
# Set so debug trap will work be invoked in subshells.
|
||||
set -o functrace > /dev/null 2>&1
|
||||
shopt -s extdebug > /dev/null 2>&1
|
||||
fi;
|
||||
fi
|
||||
|
||||
local existing_prompt_command
|
||||
# Remove setting our trap install string and sanitize the existing prompt command string
|
||||
@@ -371,7 +371,7 @@ __bp_install_after_session_init() {
|
||||
if [[ -n "$sanitized_prompt_command" ]]; then
|
||||
# shellcheck disable=SC2178 # PROMPT_COMMAND is not an array in bash <= 5.0
|
||||
PROMPT_COMMAND=${sanitized_prompt_command}$'\n'
|
||||
fi;
|
||||
fi
|
||||
# shellcheck disable=SC2179 # PROMPT_COMMAND is not an array in bash <= 5.0
|
||||
PROMPT_COMMAND+=${__bp_install_string}
|
||||
}
|
||||
@@ -379,4 +379,4 @@ __bp_install_after_session_init() {
|
||||
# Run our install so long as we're not delaying it.
|
||||
if [[ -z "${__bp_delay_install:-}" ]]; then
|
||||
__bp_install_after_session_init
|
||||
fi;
|
||||
fi
|
||||
|
Reference in New Issue
Block a user