-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.mise-en-place
52 lines (47 loc) · 1.41 KB
/
.mise-en-place
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
export MISE_SHELL=zsh
export __MISE_ORIG_PATH="$PATH"
mise() {
local command
command="${1:-}"
if [ "$#" = 0 ]; then
command /opt/homebrew/bin/mise
return
fi
shift
case "$command" in
deactivate|s|shell)
# if argv doesn't contains -h,--help
if [[ ! " $@ " =~ " --help " ]] && [[ ! " $@ " =~ " -h " ]]; then
eval "$(command /opt/homebrew/bin/mise "$command" "$@")"
return $?
fi
;;
esac
command /opt/homebrew/bin/mise "$command" "$@"
}
_mise_hook() {
eval "$(/opt/homebrew/bin/mise hook-env -s zsh)";
}
typeset -ag precmd_functions;
if [[ -z "${precmd_functions[(r)_mise_hook]+1}" ]]; then
precmd_functions=( _mise_hook ${precmd_functions[@]} )
fi
typeset -ag chpwd_functions;
if [[ -z "${chpwd_functions[(r)_mise_hook]+1}" ]]; then
chpwd_functions=( _mise_hook ${chpwd_functions[@]} )
fi
if [ -z "${_mise_cmd_not_found:-}" ]; then
_mise_cmd_not_found=1
[ -n "$(declare -f command_not_found_handler)" ] && eval "${$(declare -f command_not_found_handler)/command_not_found_handler/_command_not_found_handler}"
function command_not_found_handler() {
if /opt/homebrew/bin/mise hook-not-found -s zsh -- "$1"; then
_mise_hook
"$@"
elif [ -n "$(declare -f _command_not_found_handler)" ]; then
_command_not_found_handler "$@"
else
echo "zsh: command not found: $1" >&2
return 127
fi
}
fi