Skip to content

Commit

Permalink
fix bash command not found override
Browse files Browse the repository at this point in the history
Fixes #1558
Fixes #1563
  • Loading branch information
jdx committed Jan 31, 2024
1 parent 7f900c4 commit a327bd6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions man/man1/mise.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH mise 1 "mise 2024.1.32"
.TH mise 1 "mise 2024.1.33"
.SH NAME
mise \- The front\-end to your dev env
.SH SYNOPSIS
Expand Down Expand Up @@ -179,6 +179,6 @@ Examples:
$ mise settings Show settings in use
$ mise settings set color 0 Disable color by modifying global config file
.SH VERSION
v2024.1.32
v2024.1.33
.SH AUTHORS
Jeff Dickey <@jdx>
5 changes: 4 additions & 1 deletion src/shell/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ impl Shell for Bash {
out.push_str(&formatdoc! {r#"
if [ -z "${{_mise_cmd_not_found:-}}" ]; then
_mise_cmd_not_found=1
[ -n "$(declare -f command_not_found_handle)" ] && eval "${{$(declare -f command_not_found_handle)/command_not_found_handle/_command_not_found_handle}}"
if [ -n "$(declare -f command_not_found_handle)" ]; then
_mise_cmd_not_found_handle=$(declare -f command_not_found_handle)
eval "${{_mise_cmd_not_found_handle/command_not_found_handle/_command_not_found_handle}}"
fi
command_not_found_handle() {{
if {exe} hook-not-found -s bash -- "$1"; then
Expand Down
5 changes: 4 additions & 1 deletion src/shell/snapshots/mise__shell__bash__tests__activate.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ if [[ ";${PROMPT_COMMAND:-};" != *";_mise_hook;"* ]]; then
fi
if [ -z "${_mise_cmd_not_found:-}" ]; then
_mise_cmd_not_found=1
[ -n "$(declare -f command_not_found_handle)" ] && eval "${$(declare -f command_not_found_handle)/command_not_found_handle/_command_not_found_handle}"
if [ -n "$(declare -f command_not_found_handle)" ]; then
_mise_cmd_not_found_handle=$(declare -f command_not_found_handle)
eval "${_mise_cmd_not_found_handle/command_not_found_handle/_command_not_found_handle}"
fi

command_not_found_handle() {
if /some/dir/mise hook-not-found -s bash -- "$1"; then
Expand Down

0 comments on commit a327bd6

Please sign in to comment.